On Thu, 2023-10-12 at 22:39 +0900, Tetsuo Handa wrote: > Hello. > > I'm having problem with finding BPF LSM examples that work. > I tried building tools/testing/selftests/bpf/progs/lsm.c and > tools/testing/selftests/bpf/prog_tests/test_lsm.c explained at > https://docs.kernel.org/bpf/prog_lsm.html , but got a lot of errors. Hello, > Is tools/testing/selftests/bpf/ maintained? It pretty much is, build it every day :) And we have a CI too: https://github.com/kernel-patches/bpf . I tried setting up a minimal Debian chroot to showcase the build and came up with the following list of commands: # Use trixie to get llvm-16 sudo /usr/sbin/debootstrap --variant=buildd --arch=amd64 trixie trixie-chroot/ http://deb.debian.org/debian # don't forget to umount with 'umount -R ...' sudo mount --rbind /dev/pts trixie-chroot/dev/pts sudo mount -t proc proc trixie-chroot/proc sudo chroot trixie-chroot # The reset of commands are from chroot itself, first as root apt install build-essential llvm clang lld bc flex bison pahole git \ libelf-dev libssl-dev docutils-common rsync # Note: you might want to build pahole from source useradd -d /home/eddy -s /bin/bash eddy mkdir /home/eddy chown eddy /home/eddy su eddy # Now as a user 'eddy': cd /home/eddy git clone https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git cd linux/ ./scripts/kconfig/merge_config.sh tools/testing/selftests/bpf/config tools/testing/selftests/bpf/config.x86_64 # Note: kernel build is mandatory, as vmlinux.h is constructed from DWARF in ./vmlinux make -j14 make -j14 headers make -j14 -C tools/testing/selftests/bpf/ Hope this helps, Eduard