Skip to contentSkip to conversation

docs: sysctl/kernel: document BPF entries

PATCH Superseded Stephen Kitt 2 participants 3 messages Mar 9, 2020 – Mar 10, 2020

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docs: sysctl/kernel: document BPF entries

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

The section style doesn't match the surrounding sections; it matches the style of the reworked kernel.rst queued up in docs-next.

---

Notes:
Changes since v1:
- rebased on bpf-next instead of docs-next.

 Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst +24 -0
index def074807cee..eea7afd509ac 100644
@@ -174,6 +174,20 @@ See the type_of_loader and ext_loader_ver fields in
 Documentation/x86/boot.rst 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:
 =============
 
@@ -1123,6 +1137,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:
 =========
 

base-commit: 3e7c67d90e3ed2f34fce42699f11b150dd1d3999

Signature · 1 line
2.20.1
#1 lore raw
Quoted 44 lines · 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.

The section style doesn't match the surrounding sections; it matches the style of the reworked kernel.rst queued up in docs-next.

---

Notes:
Changes since v1:
- rebased on bpf-next instead of docs-next.

 Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst +14 -0
index def074807cee..eea7afd509ac 100644
@@ -174,6 +174,20 @@ See the type_of_loader and ext_loader_ver fields in
 Documentation/x86/boot.rst 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:
 =============
 

Documentation/admin-guide/sysctl/kernel.rst NMI switch that most IA32 servers have fires unknown NMI up, for · line 1143

Quoted 7 lines
Documentation/admin-guide/sysctl/kernel.rst +4 -0
@@ -1123,6 +1137,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()``;

same typo as was pointed out earlier.

#2 lore raw
Quoted 50 lines · Alexei Starovoitov
Quoted 49 lines · 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.

The section style doesn't match the surrounding sections; it matches the style of the reworked kernel.rst queued up in docs-next.

---

Notes:
Changes since v1:
- rebased on bpf-next instead of docs-next.

 Documentation/admin-guide/sysctl/kernel.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)
(quoted diff) +0 -0

b/Documentation/admin-guide/sysctl/kernel.rst index def074807cee..eea7afd509ac 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -174,6 +174,20 @@ See the type_of_loader and ext_loader_ver fields in Documentation/x86/boot.rst for additional information.

Documentation/admin-guide/sysctl/kernel.rst +14 -0
+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:
 =============
@@ -1123,6 +1137,16 @@ NMI switch that most IA32 servers have fires

unknown NMI up, for example. If a system hangs up, try pressing the NMI switch.

Quoted 6 lines

Documentation/admin-guide/sysctl/kernel.rst NMI switch that most IA32 servers have fires unknown NMI up, for · line 1143

Quoted 4 lines
Documentation/admin-guide/sysctl/kernel.rst +4 -0
+unprivileged_bpf_disabled
+=========================
+
+Writing 1 to this entry will disabled unprivileged calls to ``bpf()``;  

same typo as was pointed out earlier.

Oh dear, sorry about that, v3 is on its way :-(.

Regards,

Stephen