Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: propagate kvmemdup_bpfptr errors from bpf_prog_verify_signature

kvmemdup_bpfptr() returns -EFAULT when the user pointer cannot be
copied, and -ENOMEM on allocation failure. The error path always
returned -ENOMEM, misreporting bad addresses as out-of-memory.

Return PTR_ERR(sig) so user space gets the correct errno.

Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/tencent_C9C5B2B28413D6303D505CD02BFEA4708C07@qq.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Weixie Cui and committed by
Alexei Starovoitov
ad2f7ed0 280de43e

+1 -1
+1 -1
kernel/bpf/syscall.c
··· 2832 2832 sig = kvmemdup_bpfptr(usig, attr->signature_size); 2833 2833 if (IS_ERR(sig)) { 2834 2834 bpf_key_put(key); 2835 - return -ENOMEM; 2835 + return PTR_ERR(sig); 2836 2836 } 2837 2837 2838 2838 bpf_dynptr_init(&sig_ptr, sig, BPF_DYNPTR_TYPE_LOCAL, 0,