History

Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Daniel Borkmann says: ==================== bpf 2021-12-08 We've added 12 non-merge commits during the last 22 day(s) which contain a total of 29 files changed, 659 insertions(+), 80 deletions(-). The main changes are: 1) Fix an off-by-two error in packet range markings and also add a batch of new tests for coverage of these corner cases, from Maxim Mikityanskiy. 2) Fix a compilation issue on MIPS JIT for R10000 CPUs, from Johan Almbladh. 3) Fix two functional regressions and a build warning related to BTF kfunc for modules, from Kumar Kartikeya Dwivedi. 4) Fix outdated code and docs regarding BPF's migrate_disable() use on non- PREEMPT_RT kernels, from Sebastian Andrzej Siewior. 5) Add missing includes in order to be able to detangle cgroup vs bpf header dependencies, from Jakub Kicinski. 6) Fix regression in BPF sockmap tests caused by missing detachment of progs from sockets when they are removed from the map, from John Fastabend. 7) Fix a missing "no previous prototype" warning in x86 JIT caused by BPF dispatcher, from Björn Töpel. * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: bpf: Add selftests to cover packet access corner cases bpf: Fix the off-by-two error in range markings treewide: Add missing includes masked by cgroup -> bpf dependency tools/resolve_btfids: Skip unresolved symbol warning for empty BTF sets bpf: Fix bpf_check_mod_kfunc_call for built-in modules bpf: Make CONFIG_DEBUG_INFO_BTF depend upon CONFIG_BPF_SYSCALL mips, bpf: Fix reference to non-existing Kconfig symbol bpf: Make sure bpf_disable_instrumentation() is safe vs preemption. Documentation/locking/locktypes: Update migrate_disable() bits. bpf, sockmap: Re-evaluate proto ops when psock is removed from sockmap bpf, sockmap: Attach map progs to psock early for feature probes bpf, x86: Fix "no previous prototype" warning ====================

Jakub Kicinski committed 4 years ago

Commit 6efcdad2 parents 2b29cb9 b560b2129 files · +659 −80Browse files

Showing the changes to include/linux (5 of 29 files). Show all

Unified · Split

5 files
  1. include/linux/bpf.h +3 −14
  2. include/linux/btf.h +10 −4
  3. include/linux/cacheinfo.h +0 −1
  4. include/linux/device/driver.h +1 −0
  5. include/linux/filter.h +1 −4
include/linux/bpf.h+3−14
@@ -732,6 +732,7 @@ int bpf_trampoline_unlink_prog(struct bpf_prog *prog, struct bpf_trampoline *tr) · 731 unmodified lines
732732 struct bpf_trampoline *bpf_trampoline_get(u64 key,
733733 struct bpf_attach_target_info *tgt_info);
734734 void bpf_trampoline_put(struct bpf_trampoline *tr);
735+int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs);
735736 #define BPF_DISPATCHER_INIT(_name) { \
736737 .mutex = __MUTEX_INITIALIZER(_name.mutex), \
737738 .func = &_name##_func, \
@@ -1352,28 +1353,16 @@ extern struct mutex bpf_stats_enabled_mutex; · 614 unmodified lines
13521353 * kprobes, tracepoints) to prevent deadlocks on map operations as any of
13531354 * these events can happen inside a region which holds a map bucket lock
13541355 * and can deadlock on it.
1355− *
1356− * Use the preemption safe inc/dec variants on RT because migrate disable
1357− * is preemptible on RT and preemption in the middle of the RMW operation
1358− * might lead to inconsistent state. Use the raw variants for non RT
1359− * kernels as migrate_disable() maps to preempt_disable() so the slightly
1360− * more expensive save operation can be avoided.
13611356 */
13621357 static inline void bpf_disable_instrumentation(void)
13631358 {
13641359 migrate_disable();
1365− if (IS_ENABLED(CONFIG_PREEMPT_RT))
1366− this_cpu_inc(bpf_prog_active);
1367− else
1368− __this_cpu_inc(bpf_prog_active);
1360+ this_cpu_inc(bpf_prog_active);
13691361 }
13701362
13711363 static inline void bpf_enable_instrumentation(void)
13721364 {
1373− if (IS_ENABLED(CONFIG_PREEMPT_RT))
1374− this_cpu_dec(bpf_prog_active);
1375− else
1376− __this_cpu_dec(bpf_prog_active);
1365+ this_cpu_dec(bpf_prog_active);
13771366 migrate_enable();
13781367 }
13791368
include/linux/btf.h+10−4
@@ -245,7 +245,10 @@ struct kfunc_btf_id_set { · 244 unmodified lines
245245 struct module *owner;
246246 };
247247
248−struct kfunc_btf_id_list;
248+struct kfunc_btf_id_list {
249+ struct list_head list;
250+ struct mutex mutex;
251+};
249252
250253 #ifdef CONFIG_DEBUG_INFO_BTF_MODULES
251254 void register_kfunc_btf_id_set(struct kfunc_btf_id_list *l,
@@ -254,6 +257,9 @@ void unregister_kfunc_btf_id_set(struct kfunc_btf_id_list *l, · 2 unmodified lines
254257 struct kfunc_btf_id_set *s);
255258 bool bpf_check_mod_kfunc_call(struct kfunc_btf_id_list *klist, u32 kfunc_id,
256259 struct module *owner);
260+
261+extern struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list;
262+extern struct kfunc_btf_id_list prog_test_kfunc_list;
257263 #else
258264 static inline void register_kfunc_btf_id_set(struct kfunc_btf_id_list *l,
259265 struct kfunc_btf_id_set *s)
@@ -268,13 +274,13 @@ static inline bool bpf_check_mod_kfunc_call(struct kfunc_btf_id_list *klist, · 8 unmodified lines
268274 {
269275 return false;
270276 }
277+
278+static struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list __maybe_unused;
279+static struct kfunc_btf_id_list prog_test_kfunc_list __maybe_unused;
271280 #endif
272281
273282 #define DEFINE_KFUNC_BTF_ID_SET(set, name) \
274283 struct kfunc_btf_id_set name = { LIST_HEAD_INIT(name.list), (set), \
275284 THIS_MODULE }
276285
277−extern struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list;
278−extern struct kfunc_btf_id_list prog_test_kfunc_list;
279−
280286 #endif
include/linux/cacheinfo.h+0−1
@@ -3,7 +3,6 @@ · 2 unmodified lines
33 #define _LINUX_CACHEINFO_H
44
55 #include <linux/bitops.h>
6−#include <linux/cpu.h>
76 #include <linux/cpumask.h>
87 #include <linux/smp.h>
98
include/linux/device/driver.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/klist.h>
1919 #include <linux/pm.h>
2020 #include <linux/device/bus.h>
21+#include <linux/module.h>
2122
2223 /**
2324 * enum probe_type - device driver probe type to try
include/linux/filter.h+1−4
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #define __LINUX_FILTER_H__
77
88 #include <linux/atomic.h>
9+#include <linux/bpf.h>
910 #include <linux/refcount.h>
1011 #include <linux/compat.h>
1112 #include <linux/skbuff.h>
@@ -26,7 +27,6 @@ · 14 unmodified lines
2627
2728 #include <asm/byteorder.h>
2829 #include <uapi/linux/filter.h>
29−#include <uapi/linux/bpf.h>
3030
3131 struct sk_buff;
3232 struct sock;
@@ -640,9 +640,6 @@ static __always_inline u32 bpf_prog_run(const struct bpf_prog *prog, const void · 607 unmodified lines
640640 * This uses migrate_disable/enable() explicitly to document that the
641641 * invocation of a BPF program does not require reentrancy protection
642642 * against a BPF program which is invoked from a preempting task.
643− *
644− * For non RT enabled kernels migrate_disable/enable() maps to
645− * preempt_disable/enable(), i.e. it disables also preemption.
646643 */
647644 static inline u32 bpf_prog_run_pin_on_cpu(const struct bpf_prog *prog,
648645 const void *ctx)