Skip to content

Enable strict percpu address space checks

Uros Bizjak bpf linux-arch linux-bcachefs linux-mm lkml netdev 5 versions – Applied

Status from this message: [merged mm-stable] percpu-x86-enable-strict-percpu-checks-via-named-as-qualifiers.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 19 repliesApplied 6/6
  2. v36 patches 7 repliesApplied 6/6
  3. v2 posting 2/26 patches 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC posting 1/24 patches4 repliesSuperseded
v1 RFC3 patches3 repliesSuperseded

Patches in v4 All 6 applied

#Subject and filesSizeRepliesApplied
1/6x86/kgdb: Use IS_ERR_PCPU() macroarch/x86/kernel/kgdb.c+1 -10 repliesApplied
2/6compiler.h: Introduce TYPEOF_UNQUAL() macroinclude/linux/compiler-clang.h include/linux/compiler-gcc.h include/linux/compiler.h+36 -00 repliesApplied
3/6percpu: Use TYPEOF_UNQUAL() in variable declarationsarch/x86/include/asm/percpu.h fs/bcachefs/util.h include/asm-generic/percpu.h +5 more+27 -280 repliesApplied
4/6percpu: Use TYPEOF_UNQUAL() in *_cpu_ptr() accessorsarch/x86/include/asm/percpu.h include/linux/percpu-defs.h+7 -30 repliesApplied
5/6percpu: Repurpose __percpu tag as a named address space qualifierinclude/asm-generic/percpu.h include/linux/compiler_types.h+14 -10 repliesApplied
6/6percpu/x86: Enable strict percpu checks via named AS qualifiersarch/x86/include/asm/percpu.h+12 -319 repliesApplied

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchNadav AmitChristoph Lameter
1/6A-b
2/6
3/6A-b A-b
4/6A-b A-b
5/6A-b
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/6] Enable strict percpu address space checks

Enable strict percpu address space checks via x86 named address space qualifiers. Percpu variables are declared in __seg_gs/__seg_fs named AS and kept named AS qualified until they are dereferenced via percpu accessor. This approach enables various compiler checks for cross-namespace variable assignments.

Please note that current version of sparse doesn't know anything about __typeof_unqual__() operator. Avoid the usage of __typeof_unqual__() when sparse checking is active to prevent sparse errors with unknowing keyword. The proposed patch by Dan Carpenter to implement __typeof_unqual__() handling in sparse is located at:

https://lore.kernel.org/lkml/[email protected]/

v2: - Add comment to remove test for __CHECKER__ once sparse learns
about __typeof_unqual__.
- Add Acked-by: tags.
v3: - Rename __per_cpu_qual to __percpu_qual.
- Add more Acked-by: tags.
v4: - Do not auto-detect compiler support for __typeof_unqual__()

Cc Thomas Gleixner <[email protected]>
Cc Dennis Zhou <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Nadav Amit <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Peter Zijlstra <[email protected]>

Uros Bizjak (6):
x86/kgdb: Use IS_ERR_PCPU() macro
compiler.h: Introduce TYPEOF_UNQUAL() macro
percpu: Use TYPEOF_UNQUAL() in variable declarations
percpu: Use TYPEOF_UNQUAL() in *_cpu_ptr() accessors
percpu: Repurpose __percpu tag as a named address space qualifier percpu/x86: Enable strict percpu checks via named AS qualifiers

 arch/x86/include/asm/percpu.h  | 33 +++++++++++++++++++---------
 arch/x86/kernel/kgdb.c         |  2 +-
 fs/bcachefs/util.h             |  2 +-
 include/asm-generic/percpu.h   | 39 ++++++++++++++++++++++------------
 include/linux/compiler-clang.h |  8 +++++++
 include/linux/compiler-gcc.h   |  8 +++++++
 include/linux/compiler.h       | 20 +++++++++++++++++
 include/linux/compiler_types.h |  2 +-
 include/linux/part_stat.h      |  2 +-
 include/linux/percpu-defs.h    |  6 +++---
 include/net/snmp.h             |  5 ++---
 kernel/locking/percpu-rwsem.c  |  2 +-
 net/mpls/internal.h            |  4 ++--
 13 files changed, 97 insertions(+), 36 deletions(-)
Signature · 1 line
2.42.0