Message ID | 20230502181418.308479-1-kuifeng@meta.com (mailing list archive) |
---|---|
State | Accepted |
Commit | fedf99200ab086c42a572fca1d7266b06cdc3e3f |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] bpf: Print a warning only if writing to unprivileged_bpf_disabled. | expand |
On 5/2/23 11:14 AM, Kui-Feng Lee wrote: > Only print the warning message if you are writing to > "/proc/sys/kernel/unprivileged_bpf_disabled". > > The kernel may print an annoying warning when you read > "/proc/sys/kernel/unprivileged_bpf_disabled" saying > > WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible > via Spectre v2 BHB attacks! > > However, this message is only meaningful when the feature is > disabled or enabled. > > Signed-off-by: Kui-Feng Lee <kuifeng@meta.com> Acked-by: Yonghong Song <yhs@fb.com>
Hello: This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <andrii@kernel.org>: On Tue, 2 May 2023 11:14:18 -0700 you wrote: > Only print the warning message if you are writing to > "/proc/sys/kernel/unprivileged_bpf_disabled". > > The kernel may print an annoying warning when you read > "/proc/sys/kernel/unprivileged_bpf_disabled" saying > > WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible > via Spectre v2 BHB attacks! > > [...] Here is the summary with links: - [bpf-next] bpf: Print a warning only if writing to unprivileged_bpf_disabled. https://git.kernel.org/bpf/bpf-next/c/fedf99200ab0 You are awesome, thank you!
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 14f39c1e573e..909c112ef537 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5380,7 +5380,8 @@ static int bpf_unpriv_handler(struct ctl_table *table, int write, *(int *)table->data = unpriv_enable; } - unpriv_ebpf_notify(unpriv_enable); + if (write) + unpriv_ebpf_notify(unpriv_enable); return ret; }
Only print the warning message if you are writing to "/proc/sys/kernel/unprivileged_bpf_disabled". The kernel may print an annoying warning when you read "/proc/sys/kernel/unprivileged_bpf_disabled" saying WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks! However, this message is only meaningful when the feature is disabled or enabled. Signed-off-by: Kui-Feng Lee <kuifeng@meta.com> --- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)