lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 4 Dec 2020 19:09:51 -0800 From: Andrii Nakryiko <andrii@...nel.org> To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>, <daniel@...earbox.net> CC: <andrii@...nel.org>, <kernel-team@...com>, Alexei Starovoitov <ast@...nel.org> Subject: [PATCH bpf-next] bpf: return -EOPNOTSUPP when attaching to non-kernel BTF Return -EOPNOTSUPP if tracing BPF program is attempted to be attached with specified attach_btf_obj_fd pointing to non-kernel (neither vmlinux nor module) BTF object. This scenario might be supported in the future and isn't outright invalid, so -EINVAL isn't the most appropriate error code. Suggested-by: Alexei Starovoitov <ast@...nel.org> Signed-off-by: Andrii Nakryiko <andrii@...nel.org> --- kernel/bpf/syscall.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 0cd3cc2af9c1..7e2bf671c6db 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2121,8 +2121,11 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr) if (IS_ERR(attach_btf)) return -EINVAL; if (!btf_is_kernel(attach_btf)) { + /* attaching through specifying bpf_prog's BTF + * objects directly might be supported eventually + */ btf_put(attach_btf); - return -EINVAL; + return -EOPNOTSUPP; } } } else if (attr->attach_btf_id) { -- 2.24.1
Powered by blists - more mailing lists