linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/6] Enable strict percpu address space checks
@ 2025-01-27 16:05 Uros Bizjak
  2025-01-27 16:05 ` [PATCH v4 1/6] x86/kgdb: Use IS_ERR_PCPU() macro Uros Bizjak
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Uros Bizjak @ 2025-01-27 16:05 UTC (permalink / raw)
  To: x86, linux-mm, linux-kernel, linux-bcachefs, linux-arch, netdev
  Cc: Uros Bizjak, Thomas Gleixner, Dennis Zhou, Tejun Heo,
	Christoph Lameter, Linus Torvalds, Andrew Morton, Andy Lutomirski,
	Ingo Molnar, Nadav Amit, Brian Gerst, Dan Carpenter,
	H . Peter Anvin, Peter Zijlstra

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/5b8d0dee-8fb6-45af-ba6c-7f74aff9a4b8@stanley.mountain/

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 <tglx@linutronix.de>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>

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(-)

-- 
2.42.0



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2025-06-07 14:31 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 16:05 [PATCH v4 0/6] Enable strict percpu address space checks Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 1/6] x86/kgdb: Use IS_ERR_PCPU() macro Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 2/6] compiler.h: Introduce TYPEOF_UNQUAL() macro Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 3/6] percpu: Use TYPEOF_UNQUAL() in variable declarations Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 4/6] percpu: Use TYPEOF_UNQUAL() in *_cpu_ptr() accessors Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 5/6] percpu: Repurpose __percpu tag as a named address space qualifier Uros Bizjak
2025-01-27 16:05 ` [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers Uros Bizjak
2025-04-09 11:07   ` Jiri Slaby
2025-04-09 11:43     ` Uros Bizjak
2025-04-09 15:09       ` H. Peter Anvin
2025-04-09 15:15         ` Uros Bizjak
2025-06-05 14:27   ` Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers] Jiri Slaby
2025-06-05 14:32     ` Jiri Slaby
2025-06-05 16:17       ` Alexei Starovoitov
2025-06-05 14:39     ` Dr. David Alan Gilbert
2025-06-05 17:15     ` Dave Hansen
2025-06-05 17:31       ` Uros Bizjak
2025-06-06  9:17         ` Jiri Slaby
2025-06-06  9:27           ` Uros Bizjak
2025-06-06 13:56             ` James Bottomley
2025-06-06 16:39             ` Alexei Starovoitov
2025-06-06 18:48               ` Uros Bizjak
2025-06-06 15:43           ` Dave Hansen
2025-06-07  8:52             ` Uros Bizjak
2025-06-07 14:12               ` Dave Hansen
2025-06-07 14:31                 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).