|
62 | 62 | #include <linux/binfmts.h> |
63 | 63 | #include <linux/sched/sysctl.h> |
64 | 64 | #include <linux/kexec.h> |
65 | | -#include <linux/bpf.h> |
66 | 65 | #include <linux/mount.h> |
67 | 66 | #include <linux/userfaultfd_k.h> |
68 | 67 | #include <linux/latencytop.h> |
@@ -139,66 +138,6 @@ static const int max_extfrag_threshold = 1000; |
139 | 138 |
|
140 | 139 | #endif /* CONFIG_SYSCTL */ |
141 | 140 |
|
142 | | -#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) |
143 | | -static int bpf_stats_handler(struct ctl_table *table, int write, |
144 | | - void *buffer, size_t *lenp, loff_t *ppos) |
145 | | -{ |
146 | | - struct static_key *key = (struct static_key *)table->data; |
147 | | - static int saved_val; |
148 | | - int val, ret; |
149 | | - struct ctl_table tmp = { |
150 | | - .data = &val, |
151 | | - .maxlen = sizeof(val), |
152 | | - .mode = table->mode, |
153 | | - .extra1 = SYSCTL_ZERO, |
154 | | - .extra2 = SYSCTL_ONE, |
155 | | - }; |
156 | | - |
157 | | - if (write && !capable(CAP_SYS_ADMIN)) |
158 | | - return -EPERM; |
159 | | - |
160 | | - mutex_lock(&bpf_stats_enabled_mutex); |
161 | | - val = saved_val; |
162 | | - ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
163 | | - if (write && !ret && val != saved_val) { |
164 | | - if (val) |
165 | | - static_key_slow_inc(key); |
166 | | - else |
167 | | - static_key_slow_dec(key); |
168 | | - saved_val = val; |
169 | | - } |
170 | | - mutex_unlock(&bpf_stats_enabled_mutex); |
171 | | - return ret; |
172 | | -} |
173 | | - |
174 | | -void __weak unpriv_ebpf_notify(int new_state) |
175 | | -{ |
176 | | -} |
177 | | - |
178 | | -static int bpf_unpriv_handler(struct ctl_table *table, int write, |
179 | | - void *buffer, size_t *lenp, loff_t *ppos) |
180 | | -{ |
181 | | - int ret, unpriv_enable = *(int *)table->data; |
182 | | - bool locked_state = unpriv_enable == 1; |
183 | | - struct ctl_table tmp = *table; |
184 | | - |
185 | | - if (write && !capable(CAP_SYS_ADMIN)) |
186 | | - return -EPERM; |
187 | | - |
188 | | - tmp.data = &unpriv_enable; |
189 | | - ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
190 | | - if (write && !ret) { |
191 | | - if (locked_state && unpriv_enable != 1) |
192 | | - return -EPERM; |
193 | | - *(int *)table->data = unpriv_enable; |
194 | | - } |
195 | | - |
196 | | - unpriv_ebpf_notify(unpriv_enable); |
197 | | - |
198 | | - return ret; |
199 | | -} |
200 | | -#endif /* CONFIG_BPF_SYSCALL && CONFIG_SYSCTL */ |
201 | | - |
202 | 141 | /* |
203 | 142 | * /proc/sys support |
204 | 143 | */ |
@@ -2112,24 +2051,6 @@ static struct ctl_table kern_table[] = { |
2112 | 2051 | .extra2 = SYSCTL_ONE, |
2113 | 2052 | }, |
2114 | 2053 | #endif |
2115 | | -#ifdef CONFIG_BPF_SYSCALL |
2116 | | - { |
2117 | | - .procname = "unprivileged_bpf_disabled", |
2118 | | - .data = &sysctl_unprivileged_bpf_disabled, |
2119 | | - .maxlen = sizeof(sysctl_unprivileged_bpf_disabled), |
2120 | | - .mode = 0644, |
2121 | | - .proc_handler = bpf_unpriv_handler, |
2122 | | - .extra1 = SYSCTL_ZERO, |
2123 | | - .extra2 = SYSCTL_TWO, |
2124 | | - }, |
2125 | | - { |
2126 | | - .procname = "bpf_stats_enabled", |
2127 | | - .data = &bpf_stats_enabled_key.key, |
2128 | | - .maxlen = sizeof(bpf_stats_enabled_key), |
2129 | | - .mode = 0644, |
2130 | | - .proc_handler = bpf_stats_handler, |
2131 | | - }, |
2132 | | -#endif |
2133 | 2054 | #if defined(CONFIG_TREE_RCU) |
2134 | 2055 | { |
2135 | 2056 | .procname = "panic_on_rcu_stall", |
|
0 commit comments