linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: sysctl/kernel: document BPF entries
@ 2020-02-21 16:58 Stephen Kitt
  2020-02-23 22:44 ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Kitt @ 2020-02-21 16:58 UTC (permalink / raw)
  To: Jonathan Corbet, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko, bpf,
	linux-doc
  Cc: linux-kernel, Stephen Kitt

Based on the implementation in kernel/bpf/syscall.c,
kernel/bpf/trampoline.c, include/linux/filter.h, and the documentation
in bpftool-prog.rst.

Signed-off-by: Stephen Kitt <steve@sk2.org>
---
 Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index 1c48ab4bfe30..89c70ea7de7c 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -102,6 +102,20 @@ See the ``type_of_loader`` and ``ext_loader_ver`` fields in
 :doc:`/x86/boot` for additional information.
 
 
+bpf_stats_enabled
+=================
+
+Controls whether the kernel should collect statistics on BPF programs
+(total time spent running, number of times run...). Enabling
+statistics causes a slight reduction in performance on each program
+run. The statistics can be seen using ``bpftool``.
+
+= ===================================
+0 Don't collect statistics (default).
+1 Collect statistics.
+= ===================================
+
+
 cap_last_cap
 ============
 
@@ -1152,6 +1166,16 @@ NMI switch that most IA32 servers have fires unknown NMI up, for
 example.  If a system hangs up, try pressing the NMI switch.
 
 
+unprivileged_bpf_disabled
+=========================
+
+Writing 1 to this entry will disabled unprivileged calls to ``bpf()``;
+once disabled, calling ``bpf()`` without ``CAP_SYS_ADMIN`` will return
+``-EPERM``.
+
+Once set, this can't be cleared.
+
+
 watchdog
 ========
 
-- 
2.20.1


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

* Re: [PATCH] docs: sysctl/kernel: document BPF entries
  2020-02-21 16:58 [PATCH] docs: sysctl/kernel: document BPF entries Stephen Kitt
@ 2020-02-23 22:44 ` Alexei Starovoitov
  2020-02-24 19:50   ` Stephen Kitt
  0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2020-02-23 22:44 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Jonathan Corbet, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko, bpf,
	open list:DOCUMENTATION, LKML

On Fri, Feb 21, 2020 at 10:18 AM Stephen Kitt <steve@sk2.org> wrote:
>
> Based on the implementation in kernel/bpf/syscall.c,
> kernel/bpf/trampoline.c, include/linux/filter.h, and the documentation
> in bpftool-prog.rst.
>
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> ---
>  Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index 1c48ab4bfe30..89c70ea7de7c 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -102,6 +102,20 @@ See the ``type_of_loader`` and ``ext_loader_ver`` fields in
>  :doc:`/x86/boot` for additional information.
>
>
> +bpf_stats_enabled
> +=================
> +
> +Controls whether the kernel should collect statistics on BPF programs
> +(total time spent running, number of times run...). Enabling
> +statistics causes a slight reduction in performance on each program
> +run. The statistics can be seen using ``bpftool``.
> +
> += ===================================
> +0 Don't collect statistics (default).
> +1 Collect statistics.
> += ===================================
> +
> +
>  cap_last_cap
>  ============
>
> @@ -1152,6 +1166,16 @@ NMI switch that most IA32 servers have fires unknown NMI up, for
>  example.  If a system hangs up, try pressing the NMI switch.
>
>
> +unprivileged_bpf_disabled
> +=========================
> +
> +Writing 1 to this entry will disabled unprivileged calls to ``bpf()``;

'will disable' ?

It doesn't apply to bpf-next with:
error: sha1 information is lacking or useless
(Documentation/admin-guide/sysctl/kernel.rst).
error: could not build fake ancestor
Patch failed at 0001 docs: sysctl/kernel: Document BPF entries

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

* Re: [PATCH] docs: sysctl/kernel: document BPF entries
  2020-02-23 22:44 ` Alexei Starovoitov
@ 2020-02-24 19:50   ` Stephen Kitt
  2020-02-25  5:43     ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Kitt @ 2020-02-24 19:50 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Jonathan Corbet, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko, bpf,
	open list:DOCUMENTATION, LKML

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]

On Sun, 23 Feb 2020 14:44:31 -0800, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Fri, Feb 21, 2020 at 10:18 AM Stephen Kitt <steve@sk2.org> wrote:
> > @@ -1152,6 +1166,16 @@ NMI switch that most IA32 servers have fires
> > unknown NMI up, for example.  If a system hangs up, try pressing the NMI
> > switch.
> >
> >
> > +unprivileged_bpf_disabled
> > +=========================
> > +
> > +Writing 1 to this entry will disabled unprivileged calls to ``bpf()``;  
> 
> 'will disable' ?

Indeed, thanks.

> It doesn't apply to bpf-next with:
> error: sha1 information is lacking or useless
> (Documentation/admin-guide/sysctl/kernel.rst).
> error: could not build fake ancestor
> Patch failed at 0001 docs: sysctl/kernel: Document BPF entries

Sorry, I forgot to include the base commit information; this is against
8f21f54b8a95 in docs-next.

I’ll wait for that to make it to Linus’ tree and re-submit the patch (with
the fix above).

Regards,

Stephen

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] docs: sysctl/kernel: document BPF entries
  2020-02-24 19:50   ` Stephen Kitt
@ 2020-02-25  5:43     ` Alexei Starovoitov
  2020-02-25  9:50       ` Jonathan Corbet
  0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2020-02-25  5:43 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Jonathan Corbet, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko, bpf,
	open list:DOCUMENTATION, LKML

On Mon, Feb 24, 2020 at 11:50 AM Stephen Kitt <steve@sk2.org> wrote:
>
> On Sun, 23 Feb 2020 14:44:31 -0800, Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> > On Fri, Feb 21, 2020 at 10:18 AM Stephen Kitt <steve@sk2.org> wrote:
> > > @@ -1152,6 +1166,16 @@ NMI switch that most IA32 servers have fires
> > > unknown NMI up, for example.  If a system hangs up, try pressing the NMI
> > > switch.
> > >
> > >
> > > +unprivileged_bpf_disabled
> > > +=========================
> > > +
> > > +Writing 1 to this entry will disabled unprivileged calls to ``bpf()``;
> >
> > 'will disable' ?
>
> Indeed, thanks.
>
> > It doesn't apply to bpf-next with:
> > error: sha1 information is lacking or useless
> > (Documentation/admin-guide/sysctl/kernel.rst).
> > error: could not build fake ancestor
> > Patch failed at 0001 docs: sysctl/kernel: Document BPF entries
>
> Sorry, I forgot to include the base commit information; this is against
> 8f21f54b8a95 in docs-next.
>
> I’ll wait for that to make it to Linus’ tree and re-submit the patch (with
> the fix above).

Please use bpf-next tree as a base for your patch.

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

* Re: [PATCH] docs: sysctl/kernel: document BPF entries
  2020-02-25  5:43     ` Alexei Starovoitov
@ 2020-02-25  9:50       ` Jonathan Corbet
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Corbet @ 2020-02-25  9:50 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Stephen Kitt, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko, bpf,
	open list:DOCUMENTATION, LKML

On Mon, 24 Feb 2020 21:43:33 -0800
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:

> > Sorry, I forgot to include the base commit information; this is against
> > 8f21f54b8a95 in docs-next.
> >
> > I’ll wait for that to make it to Linus’ tree and re-submit the patch (with
> > the fix above).  
> 
> Please use bpf-next tree as a base for your patch.

It seems that folks want to take this through the BPF tree, so I'll
assume it's not my problem :)

Thanks,

jon

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

end of thread, other threads:[~2020-02-25  9:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 16:58 [PATCH] docs: sysctl/kernel: document BPF entries Stephen Kitt
2020-02-23 22:44 ` Alexei Starovoitov
2020-02-24 19:50   ` Stephen Kitt
2020-02-25  5:43     ` Alexei Starovoitov
2020-02-25  9:50       ` Jonathan Corbet

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