From 20a3465b973bec140ff12740acffa6c357b27edc Mon Sep 17 00:00:00 2001 From: Cheng-Min Chiang Date: Fri, 24 Jul 2020 18:05:18 -0700 Subject: sys/linux: add descriptions for BPF LSM This commit includes the following changes: * executor: add a new syz_btf_id_by_name psuedo-syscall * sys/linux: add descriptions for BPF LSM subsystem * sys/linux: add instructions on how to dump vmlinux and install bpftool * sys/linux/test: add tests for the new psuedo-syscall * pkg/host: add support detection for the new psuedo-syscall * pkg/runtest: skip the coverage test when invoking the new psuedo-syscall Update #533. --- pkg/host/syscalls_linux.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pkg/host/syscalls_linux.go') diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go index f1c8f03c8..06e9a261f 100644 --- a/pkg/host/syscalls_linux.go +++ b/pkg/host/syscalls_linux.go @@ -243,6 +243,13 @@ func isSyzIoUringSupported(c *prog.Syscall, target *prog.Target, sandbox string) return isSupportedSyscall(ioUringSyscall, target) } +func isBtfVmlinuxSupported(c *prog.Syscall, target *prog.Target, sandbox string) (bool, string) { + if err := osutil.IsAccessible("/sys/kernel/btf/vmlinux"); err != nil { + return false, err.Error() + } + return onlySandboxNone(sandbox) +} + var syzkallSupport = map[string]func(*prog.Syscall, *prog.Target, string) (bool, string){ "syz_open_dev": isSyzOpenDevSupported, "syz_open_procfs": alwaysSupported, @@ -267,7 +274,8 @@ var syzkallSupport = map[string]func(*prog.Syscall, *prog.Target, string) (bool, "syz_io_uring_setup": isSyzIoUringSupported, // syz_memcpy_off is only used for io_uring descriptions, thus, enable it // only if io_uring syscalls are enabled. - "syz_memcpy_off": isSyzIoUringSupported, + "syz_memcpy_off": isSyzIoUringSupported, + "syz_btf_id_by_name": isBtfVmlinuxSupported, } func isSupportedSyzkall(c *prog.Syscall, target *prog.Target, sandbox string) (bool, string) { -- cgit mrf-deployment