bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2
@ 2022-03-22 14:49 Milan Landaverde
  2022-03-22 15:54 ` Quentin Monnet
  2022-03-29  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Milan Landaverde @ 2022-03-22 14:49 UTC (permalink / raw)
  Cc: milan, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Quentin Monnet, Paul Chaignon, Niklas Söderlund,
	netdev, bpf, linux-kernel

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(-)

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");
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2
  2022-03-22 14:49 [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2 Milan Landaverde
@ 2022-03-22 15:54 ` Quentin Monnet
  2022-03-22 17:39   ` KP Singh
  2022-03-29  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Quentin Monnet @ 2022-03-22 15:54 UTC (permalink / raw)
  To: Milan Landaverde
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Paul Chaignon, Niklas Söderlund, netdev, bpf,
	linux-kernel

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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2
  2022-03-22 15:54 ` Quentin Monnet
@ 2022-03-22 17:39   ` KP Singh
  0 siblings, 0 replies; 4+ messages in thread
From: KP Singh @ 2022-03-22 17:39 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Milan Landaverde, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, Paul Chaignon, Niklas Söderlund, netdev,
	bpf, linux-kernel

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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2
  2022-03-22 14:49 [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2 Milan Landaverde
  2022-03-22 15:54 ` Quentin Monnet
@ 2022-03-29  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-29  2:20 UTC (permalink / raw)
  To: Milan Landaverde
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, quentin, paul, niklas.soderlund, netdev, bpf,
	linux-kernel

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-29  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 14:49 [PATCH bpf-next] bpf/bpftool: add unprivileged_bpf_disabled check against value of 2 Milan Landaverde
2022-03-22 15:54 ` Quentin Monnet
2022-03-22 17:39   ` KP Singh
2022-03-29  2: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).