Skip to contentSkip to conversation

docs: sysctl/kernel: document BPF entries

PATCH In review Stephen Kitt 2 participants 3 messages Mar 15, 2020 – Apr 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 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.

---

Notes:
This patch is intended for docs-next, but I'd appreciate reviews from BPF developers.

Changes since v3:
- moved back to docs-next.

Changes since v2:
- fixed "will disabled" typo.

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 335696d3360d..88c51c0a5ce6 100644
@@ -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
 ============
 
@@ -1166,6 +1180,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 disable 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: 7d3d3254adaa61cba896f71497f56901deb618e5

Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 10 lines · On Sun, 15 Mar 2020 13:26:48 +0100 Stephen Kitt <[email protected]> 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.

---

Notes:
This patch is intended for docs-next, but I'd appreciate reviews from BPF developers.

Haven't seen a whole lot of those...it's been a month, so I'll ahead and apply this; it can be fixed up later if need be.

Thanks,

jon

#2 lore raw
Quoted 10 lines · Jonathan Corbet
Quoted 7 lines · On Sun, 15 Mar 2020 13:26:48 +0100 Stephen Kitt <[email protected]> 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.

---

Quoted 6 lines
Quoted 3 lines

Notes:
This patch is intended for docs-next, but I'd appreciate reviews from BPF developers.

Haven't seen a whole lot of those...it's been a month, so I'll ahead and apply this; it can be fixed up later if need be.

Thanks, I’ll start pushing my remaining sysctl doc patches.

Regards,

Stephen