Thread (11 messages) flat view 11 messages, 4 authors, 2021-08-07

Re: [PATCH v3 bpf-next 2/2] selftest/bpf: Implement sample UNIX domain socket iterator program.

From: Kuniyuki Iwashima <hidden>
Date: 2021-08-06 00:24:45
Also in: bpf

From:   Yonghong Song <redacted>
Date:   Thu, 5 Aug 2021 09:59:40 -0700
On 8/4/21 12:08 AM, Kuniyuki Iwashima wrote:
quoted
If there are no abstract sockets, this prog can output the same result
compared to /proc/net/unix.

   # cat /sys/fs/bpf/unix | head -n 2
   Num       RefCount Protocol Flags    Type St Inode Path
   ffff9ab7122db000: 00000002 00000000 00010000 0001 01 10623 private/defer

   # cat /proc/net/unix | head -n 2
   Num       RefCount Protocol Flags    Type St Inode Path
   ffff9ab7122db000: 00000002 00000000 00010000 0001 01 10623 private/defer

According to the analysis by Yonghong Song (See the link), the BPF verifier
cannot load the code in the comment to print the name of the abstract UNIX
domain socket due to LLVM optimisation.  It can be uncommented once the
LLVM code gen is improved.
I have pushed the llvm fix to llvm14 trunk 
(https://reviews.llvm.org/D107483), and filed a request to backport to 
llvm13 (https://bugs.llvm.org/show_bug.cgi?id=51363), could you in the 
next revision uncomment the "for" loop code and tested it with latest 
llvm trunk compiler? Please also add an entry in selftests/bpf/README.rst
to mention the llvm commit https://reviews.llvm.org/D107483 is needed
for bpf_iter unix_socket selftest, otherwise, they will see an error
like ...
Thank you for nice fixing so quickly!

I confirmed that the uncommented code can be loaded properly with the
latest LLVM master tree. :)

---8<---
$ sudo ./test_progs -t iter
...
#7/14 unix:OK
...
$ clang --version
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 8a557d8311593627efd08d03178889971d5ae02b)
...
$ llvm-objdump -S bpf_iter_unix.o
...
; 				 for (i = 1 ; i < len; i++)
     110:	07 09 00 00 01 00 00 00	r9 += 1
     111:	ad 89 09 00 00 00 00 00	if r9 < r8 goto +9 <LBB0_18>
---8<---

In the next revision, I'll uncomment the code and add a note in README.rst
about your fix.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help