[lxc/lxc] 7bf85d: bpf: bpf_devices_cgroup_supported() should check i...

0 views
Skip to first unread message

Christian Brauner

unread,
Jul 21, 2021, 9:25:51 AM (2 days ago) Jul 21
to lxc-...@lists.linuxcontainers.org
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: 7bf85dd20e986133324ef9d7232a2e70742d9d72
https://github.com/lxc/lxc/commit/7bf85dd20e986133324ef9d7232a2e70742d9d72
Author: Petr Malat <o...@malat.biz>
Date: 2021-07-20 (Tue, 20 Jul 2021)

Changed paths:
M src/lxc/cgroups/cgroup2_devices.c

Log Message:
-----------
bpf: bpf_devices_cgroup_supported() should check if bpf() is available

bpf_devices_cgroup_supported() tries to load a simple BPF program to
test if BPF works. This is problematic because the function used to load
the program - bpf_program_load_kernel() - emits an error to the log if
BPF is not enabled in the kernel although device controller is not
requested in the configuration. Users could interpret that as a problem.

Make bpf_devices_cgroup_supported() check if the BPF syscall is available
before calling bpf_program_load_kernel(). We can do it by passing a NULL
pointer instead of the syscall argument as the kernel returns either
ENOSYS, when the syscall is not implemented or EFAULT, when it is
implemented.

Signed-off-by: Petr Malat <o...@malat.biz>


Commit: b9327b7f9245c2d3fd02a6c344e6dd40d866065c
https://github.com/lxc/lxc/commit/b9327b7f9245c2d3fd02a6c344e6dd40d866065c
Author: Christian Brauner <christia...@ubuntu.com>
Date: 2021-07-21 (Wed, 21 Jul 2021)

Changed paths:
M src/lxc/cgroups/cgroup2_devices.c

Log Message:
-----------
Merge pull request #3909 from petris/bpf_enosys_warn

bpf: simplify detection if BPF is supported


Compare: https://github.com/lxc/lxc/compare/669953fbd16c...b9327b7f9245
Reply all
Reply to author
Forward
0 new messages