On Tue, Sep 28, 2021 at 8:30 PM Yonghong Song <yhs@xxxxxx> wrote: > > clang build kernel failed the selftest probe_user. > $ ./test_progs -t probe_user > $ ... > $ test_probe_user:PASS:get_kprobe_res 0 nsec > $ test_probe_user:FAIL:check_kprobe_res wrong kprobe res from probe read: 0.0.0.0:0 > $ #94 probe_user:FAIL > > The test attached to kernel function __sys_connect(). In net/socket.c, we have > int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen) > { > ...... > } > ... > SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr, > int, addrlen) > { > return __sys_connect(fd, uservaddr, addrlen); > } > > The gcc compiler (8.5.0) does not inline __sys_connect() in syscall entry > function. But latest clang trunk did the inlining. So the bpf program > is not triggered. > > To make the test more reliable, let us kprobe the syscall entry function > instead. Note that x86_64, arm64 and s390 have syscall wrappers and they have > to be handled specially. > > Signed-off-by: Yonghong Song <yhs@xxxxxx> > --- Applied to bpf-next, thanks. > .../selftests/bpf/prog_tests/probe_user.c | 4 +-- > .../selftests/bpf/progs/test_probe_user.c | 28 +++++++++++++++++-- > 2 files changed, 28 insertions(+), 4 deletions(-) > [...]