Skip to content

Commit fedf992

Browse files
ThinkerYzu1anakryiko
authored andcommitted
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. Signed-off-by: Kui-Feng Lee <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent bf6882a commit fedf992

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/bpf/syscall.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5380,7 +5380,8 @@ static int bpf_unpriv_handler(struct ctl_table *table, int write,
53805380
*(int *)table->data = unpriv_enable;
53815381
}
53825382

5383-
unpriv_ebpf_notify(unpriv_enable);
5383+
if (write)
5384+
unpriv_ebpf_notify(unpriv_enable);
53845385

53855386
return ret;
53865387
}

0 commit comments

Comments
 (0)