xref: /openbmc/linux/kernel/bpf/Kconfig (revision 8dd3cdea)
1# SPDX-License-Identifier: GPL-2.0-only
2
3# BPF interpreter that, for example, classic socket filters depend on.
4config BPF
5	bool
6
7# Used by archs to tell that they support BPF JIT compiler plus which
8# flavour. Only one of the two can be selected for a specific arch since
9# eBPF JIT supersedes the cBPF JIT.
10
11# Classic BPF JIT (cBPF)
12config HAVE_CBPF_JIT
13	bool
14
15# Extended BPF JIT (eBPF)
16config HAVE_EBPF_JIT
17	bool
18
19# Used by archs to tell that they want the BPF JIT compiler enabled by
20# default for kernels that were compiled with BPF JIT support.
21config ARCH_WANT_DEFAULT_BPF_JIT
22	bool
23
24menu "BPF subsystem"
25
26config BPF_SYSCALL
27	bool "Enable bpf() system call"
28	select BPF
29	select IRQ_WORK
30	select TASKS_TRACE_RCU
31	select BINARY_PRINTF
32	select NET_SOCK_MSG if NET
33	select PAGE_POOL if NET
34	default n
35	help
36	  Enable the bpf() system call that allows to manipulate BPF programs
37	  and maps via file descriptors.
38
39config BPF_JIT
40	bool "Enable BPF Just In Time compiler"
41	depends on BPF
42	depends on HAVE_CBPF_JIT || HAVE_EBPF_JIT
43	depends on MODULES
44	help
45	  BPF programs are normally handled by a BPF interpreter. This option
46	  allows the kernel to generate native code when a program is loaded
47	  into the kernel. This will significantly speed-up processing of BPF
48	  programs.
49
50	  Note, an admin should enable this feature changing:
51	  /proc/sys/net/core/bpf_jit_enable
52	  /proc/sys/net/core/bpf_jit_harden   (optional)
53	  /proc/sys/net/core/bpf_jit_kallsyms (optional)
54
55config BPF_JIT_ALWAYS_ON
56	bool "Permanently enable BPF JIT and remove BPF interpreter"
57	depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT
58	help
59	  Enables BPF JIT and removes BPF interpreter to avoid speculative
60	  execution of BPF instructions by the interpreter.
61
62	  When CONFIG_BPF_JIT_ALWAYS_ON is enabled, /proc/sys/net/core/bpf_jit_enable
63	  is permanently set to 1 and setting any other value than that will
64	  return failure.
65
66config BPF_JIT_DEFAULT_ON
67	def_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON
68	depends on HAVE_EBPF_JIT && BPF_JIT
69
70config BPF_UNPRIV_DEFAULT_OFF
71	bool "Disable unprivileged BPF by default"
72	default y
73	depends on BPF_SYSCALL
74	help
75	  Disables unprivileged BPF by default by setting the corresponding
76	  /proc/sys/kernel/unprivileged_bpf_disabled knob to 2. An admin can
77	  still reenable it by setting it to 0 later on, or permanently
78	  disable it by setting it to 1 (from which no other transition to
79	  0 is possible anymore).
80
81	  Unprivileged BPF could be used to exploit certain potential
82	  speculative execution side-channel vulnerabilities on unmitigated
83	  affected hardware.
84
85	  If you are unsure how to answer this question, answer Y.
86
87source "kernel/bpf/preload/Kconfig"
88
89config BPF_LSM
90	bool "Enable BPF LSM Instrumentation"
91	depends on BPF_EVENTS
92	depends on BPF_SYSCALL
93	depends on SECURITY
94	depends on BPF_JIT
95	help
96	  Enables instrumentation of the security hooks with BPF programs for
97	  implementing dynamic MAC and Audit Policies.
98
99	  If you are unsure how to answer this question, answer N.
100
101endmenu # "BPF subsystem"
102