Skip to contentSkip to conversation

bpf: Print a warning only if writing to unprivileged_bpf_disabled.

PATCH Applied Kui-Feng Lee 3 participants 3 messages May 2, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Print a warning only if writing to unprivileged_bpf_disabled.

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.

---
 kernel/bpf/syscall.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/syscall.c +2 -1
index 14f39c1e573e..909c112ef537 100644
@@ -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;
 }
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kui-Feng Lee

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

Quoted 7 lines

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.

#2 lore raw
In reply to Kui-Feng Lee
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 10 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html