On Mon, Aug 15, 2022 at 3:18 PM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote: > > Hi Vincent, > > On Mon, 15 Aug 2022 at 18:46, Vincent Li <vincent.mc.li@xxxxxxxxx> wrote: > > > > Hi, > > > > I compile and run kernel 5.18.0 in Centos 8 from bpf-next in my dev > > machine, I also compiled bpftool from bpf-next on same machine, when > > run bpftool on same machine, I got : > > > > ./bpftool feature probe > > > > Error: bug: failed to retrieve CAP_BPF status: Invalid argument > > > > where bpftool to retrieve CAP_BPF ? from running kernel or from somewhere else? > > Yes, bpftool calls cap_get_proc() to get the capabilities of the > current process. From what I understand of your output, it looks like > capget() returns CAP_BPF: I believe the "0x1c0" value at the end is > (1<<(CAP_CHECKPOINT_RESTORE-32)) + (1<<(CAP_BPF-32)) + > (1<<(CAP_PERFMON-32)). You could probably check this with a more > recent version of strace. > > Then assuming you do retrieve CAP_BPF from capget(), I don't know why > cap_get_flag() in bpftool fails to retrieve the capability state. It > would be worth running bpftool in GDB to check what happens. The check > in libcap is here [0] but I don't see where we would fail to provide > valid arguments. Just in case, could you please let me know what > version of libcap you're using when compiling bpftool? I think I installed libcap through centos distro [root@centos-dev ~]# rpm -qi libcap.x86_64 Name : libcap Version : 2.26 Release : 4.el8 Architecture: x86_64 Install Date: Mon 14 Jun 2021 02:35:08 PM EDT Group : System Environment/Libraries Size : 129682 License : GPLv2 Signature : RSA/SHA256, Mon 15 Jun 2020 06:31:12 PM EDT, Key ID 05b555b38483c65d Source RPM : libcap-2.26-4.el8.src.rpm Build Date : Mon 15 Jun 2020 06:28:10 PM EDT Build Host : x86-02.mbox.centos.org Relocations : (not relocatable) Packager : CentOS Buildsys <bugs@xxxxxxxxxx> Vendor : CentOS URL : https://sites.google.com/site/fullycapable/ Summary : Library for getting and setting POSIX.1e capabilities Description : libcap is a library for getting and setting POSIX.1e (formerly POSIX 6) draft 15 capabilities. > > Thanks, > Quentin > > [0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_flag.c?h=libcap-2.65#n12