Commit 6efcdadc authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
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
====================

Link: https://lore.kernel.org/r/20211208155125.11826-1-daniel@iogearbox.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 2b29cb9e b560b21f
Loading
Loading
Loading
Loading
+3 −6
Original line number Original line Diff line number Diff line
@@ -439,11 +439,9 @@ preemption. The following substitution works on both kernels::
  spin_lock(&p->lock);
  spin_lock(&p->lock);
  p->count += this_cpu_read(var2);
  p->count += this_cpu_read(var2);


On a non-PREEMPT_RT kernel migrate_disable() maps to preempt_disable()
which makes the above code fully equivalent. On a PREEMPT_RT kernel
migrate_disable() ensures that the task is pinned on the current CPU which
migrate_disable() ensures that the task is pinned on the current CPU which
in turn guarantees that the per-CPU access to var1 and var2 are staying on
in turn guarantees that the per-CPU access to var1 and var2 are staying on
the same CPU.
the same CPU while the task remains preemptible.


The migrate_disable() substitution is not valid for the following
The migrate_disable() substitution is not valid for the following
scenario::
scenario::
@@ -456,9 +454,8 @@ scenario::
    p = this_cpu_ptr(&var1);
    p = this_cpu_ptr(&var1);
    p->val = func2();
    p->val = func2();


While correct on a non-PREEMPT_RT kernel, this breaks on PREEMPT_RT because
This breaks because migrate_disable() does not protect against reentrancy from
here migrate_disable() does not protect against reentrancy from a
a preempting task. A correct substitution for this case is::
preempting task. A correct substitution for this case is::


  func()
  func()
  {
  {
+1 −1
Original line number Original line Diff line number Diff line
@@ -98,7 +98,7 @@ do { \
#define emit(...) __emit(__VA_ARGS__)
#define emit(...) __emit(__VA_ARGS__)


/* Workaround for R10000 ll/sc errata */
/* Workaround for R10000 ll/sc errata */
#ifdef CONFIG_WAR_R10000
#ifdef CONFIG_WAR_R10000_LLSC
#define LLSC_beqz	beqzl
#define LLSC_beqz	beqzl
#else
#else
#define LLSC_beqz	beqz
#define LLSC_beqz	beqz
+1 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/falloc.h>
#include <linux/falloc.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/module.h>
#include "blk.h"
#include "blk.h"


static inline struct inode *bdev_file_inode(struct file *file)
static inline struct inode *bdev_file_inode(struct file *file)
+1 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/shmem_fs.h>
#include <linux/shmem_fs.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/module.h>


#ifdef CONFIG_X86
#ifdef CONFIG_X86
#include <asm/set_memory.h>
#include <asm/set_memory.h>
+1 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/slab.h> /* fault-inject.h is not standalone! */
#include <linux/slab.h> /* fault-inject.h is not standalone! */


#include <linux/fault-inject.h>
#include <linux/fault-inject.h>
#include <linux/sched/mm.h>


#include "gem/i915_gem_lmem.h"
#include "gem/i915_gem_lmem.h"
#include "i915_trace.h"
#include "i915_trace.h"
Loading