* [PATCH v2 bpf-next] bpf: return -ENOTSUPP when attaching to non-kernel BTF
@ 2020-12-08 6:43 Andrii Nakryiko
2020-12-08 16:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2020-12-08 6:43 UTC (permalink / raw)
To: bpf, netdev, ast, daniel; +Cc: andrii, kernel-team, Alexei Starovoitov
Return -ENOTSUPP 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@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.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..287be337d5f6 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 -ENOTSUPP;
}
}
} else if (attr->attach_btf_id) {
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 bpf-next] bpf: return -ENOTSUPP when attaching to non-kernel BTF
2020-12-08 6:43 [PATCH v2 bpf-next] bpf: return -ENOTSUPP when attaching to non-kernel BTF Andrii Nakryiko
@ 2020-12-08 16:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-08 16:20 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, netdev, ast, daniel, kernel-team, ast
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
On Mon, 7 Dec 2020 22:43:26 -0800 you wrote:
> Return -ENOTSUPP 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@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
>
> [...]
Here is the summary with links:
- [v2,bpf-next] bpf: return -ENOTSUPP when attaching to non-kernel BTF
https://git.kernel.org/bpf/bpf-next/c/8bdd8e275ede
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-08 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 6:43 [PATCH v2 bpf-next] bpf: return -ENOTSUPP when attaching to non-kernel BTF Andrii Nakryiko
2020-12-08 16:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).