diff mbox series

[bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2

Message ID 20220322145012.1315376-1-milan@mdaverde.com (mailing list archive)
State Accepted
Commit 8c1b21198551d795a44f08ad185f716732b47bbe
Delegated to: BPF
Headers show
Series [bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 100 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail PR summary

Commit Message

Milan Landaverde March 22, 2022, 2:49 p.m. UTC
In [1], we added a kconfig knob that can set
/proc/sys/kernel/unprivileged_bpf_disabled to 2

We now check against this value in bpftool feature probe

[1] https://lore.kernel.org/bpf/74ec548079189e4e4dffaeb42b8987bb3c852eee.1620765074.git.daniel@iogearbox.net

Signed-off-by: Milan Landaverde <milan@mdaverde.com>
---
 tools/bpf/bpftool/feature.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Quentin Monnet March 22, 2022, 3:54 p.m. UTC | #1
2022-03-22 10:49 UTC-0400 ~ Milan Landaverde <milan@mdaverde.com>
> In [1], we added a kconfig knob that can set
> /proc/sys/kernel/unprivileged_bpf_disabled to 2
> 
> We now check against this value in bpftool feature probe
> 
> [1] https://lore.kernel.org/bpf/74ec548079189e4e4dffaeb42b8987bb3c852eee.1620765074.git.daniel@iogearbox.net
> 
> Signed-off-by: Milan Landaverde <milan@mdaverde.com>

Acked-by: Quentin Monnet <quentin@isovalent.com>

Thanks!
KP Singh March 22, 2022, 5:39 p.m. UTC | #2
On Tue, Mar 22, 2022 at 4:54 PM Quentin Monnet <quentin@isovalent.com> wrote:
>
> 2022-03-22 10:49 UTC-0400 ~ Milan Landaverde <milan@mdaverde.com>
> > In [1], we added a kconfig knob that can set
> > /proc/sys/kernel/unprivileged_bpf_disabled to 2
> >
> > We now check against this value in bpftool feature probe
> >
> > [1] https://lore.kernel.org/bpf/74ec548079189e4e4dffaeb42b8987bb3c852eee.1620765074.git.daniel@iogearbox.net
> >
> > Signed-off-by: Milan Landaverde <milan@mdaverde.com>
>
> Acked-by: Quentin Monnet <quentin@isovalent.com>

Acked-by: KP Singh <kpsingh@kernel.org>

Thanks, this is very useful!
patchwork-bot+netdevbpf@kernel.org March 29, 2022, 2:20 a.m. UTC | #3
Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Tue, 22 Mar 2022 10:49:45 -0400 you wrote:
> In [1], we added a kconfig knob that can set
> /proc/sys/kernel/unprivileged_bpf_disabled to 2
> 
> We now check against this value in bpftool feature probe
> 
> [1] https://lore.kernel.org/bpf/74ec548079189e4e4dffaeb42b8987bb3c852eee.1620765074.git.daniel@iogearbox.net
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2
    https://git.kernel.org/bpf/bpf/c/8c1b21198551

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
index c2f43a5d38e0..290998c82de1 100644
--- a/tools/bpf/bpftool/feature.c
+++ b/tools/bpf/bpftool/feature.c
@@ -207,7 +207,10 @@  static void probe_unprivileged_disabled(void)
 			printf("bpf() syscall for unprivileged users is enabled\n");
 			break;
 		case 1:
-			printf("bpf() syscall restricted to privileged users\n");
+			printf("bpf() syscall restricted to privileged users (without recovery)\n");
+			break;
+		case 2:
+			printf("bpf() syscall restricted to privileged users (admin can change)\n");
 			break;
 		case -1:
 			printf("Unable to retrieve required privileges for bpf() syscall\n");