[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240805184012.358023-1-ubizjak@gmail.com>
Date: Mon, 5 Aug 2024 20:38:58 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>,
Dennis Zhou <dennis@...nel.org>,
Tejun Heo <tj@...nel.org>,
Christoph Lameter <cl@...ux.com>,
Andy Lutomirski <luto@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Nadav Amit <nadav.amit@...il.com>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Subject: [RFC PATCH 0/3] Enable strict percpu address space checks
This patchset enables 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 sparse doesn't know anything about __typeof_unqual__()
operator, so the usage of __typeof_unqual__() breaks sparse checking.
Also, the last patch hijacks __percpu tag and repurposes it as a named
address space qualifier. While this works surprisingly well in this RFC
patchset, I would really appreciate some help on how to rewrite this
hack into some "production ready" code.
Cc: Dennis Zhou <dennis@...nel.org>
Cc: Tejun Heo <tj@...nel.org>
Cc: Christoph Lameter <cl@...ux.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Nadav Amit <nadav.amit@...il.com>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Uros Bizjak (3):
percpu: Define __pcpu_typeof()
percpu: Assorted fixes found by strict percpu address space checks
percpu/x86: [RFH] Enable strict percpu checks via named AS qualifiers
arch/x86/include/asm/percpu.h | 53 ++++++++++++++++++++++++----------
arch/x86/kernel/head64.c | 3 +-
drivers/base/devres.c | 2 +-
fs/aio.c | 2 +-
include/linux/cleanup.h | 4 +--
include/linux/compiler_types.h | 2 +-
include/linux/part_stat.h | 2 +-
include/linux/percpu-defs.h | 39 ++++++++++++++++++++-----
include/linux/prandom.h | 1 +
init/Kconfig | 3 ++
kernel/events/hw_breakpoint.c | 4 +--
kernel/locking/percpu-rwsem.c | 2 +-
kernel/workqueue.c | 2 +-
lib/percpu_counter.c | 2 +-
net/core/dev.c | 2 +-
15 files changed, 87 insertions(+), 36 deletions(-)
--
2.45.2
Powered by blists - more mailing lists