summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-09-28 19:49:41 +0100
committerMark Brown <broonie@kernel.org>2026-09-28 19:49:41 +0100
commit012c37f09490db4d9b51bbcbf8def4436fc60f06 (patch)
tree29f3f8e49081cececd15361129b86b8c5bb80fbc /scripts
parent8e51dd6db0bc7fa888326c913edcb8fe8c1fdc16 (diff)
parent9999d5a07ee037d4653c7231884b0a1e45be801c (diff)
downloadlinux-next-012c37f09490db4d9b51bbcbf8def4436fc60f06.tar.gz
linux-next-012c37f09490db4d9b51bbcbf8def4436fc60f06.zip
regmap: convert map->lock/unlock users to a scoped guard
Peng Fan (OSS) <peng.fan@oss.nxp.com> says: The regmap lock is taken by calling the lock and unlock callbacks directly at every call site: map->lock(map->lock_arg); ... map->unlock(map->lock_arg); The open-coded pattern forces every error path to unlock by hand, which spreads goto out_unlock chains and duplicated unlock statements throughout regmap.c and regcache.c and makes it easy to leak the lock on a newly added return path. Define a scoped guard for the regmap lock (DEFINE_GUARD) in internal.h and convert the users to it. The lock and unlock callbacks are chosen at init time (mutex, spinlock, raw spinlock, hwspinlock or none) and return void, so an unconditional guard is sufficient. Function-scope critical sections use guard(regmap)(); sites that must run work after the lock is dropped - for example regmap_register_patch() calling regmap_async_complete() and the debugfs cache_only handler calling regcache_sync() (which takes the lock itself) - use scoped_guard(regmap, ...) so the trailing work stays outside the guarded region. regcache_sync() and regcache_sync_region() are deliberately left unconverted: they already use a single goto out unlock path, so a guard would save nothing while forcing either a goto inside a scoped_guard scope or a control-flow rewrite, neither of which is an improvement. This patchset removes many manual unlock statements together with the associated goto out_unlock labels. The series is split to keep the regcache: and regmap: changes on their own commits and to preserve independent revertibility: 1. define the guard and convert regmap.c 2. convert regcache.c (except the sync helpers, see above) 3. convert the regcache rbtree debugfs dump 4. convert the regmap debugfs write handlers No functional change. Tested with the regmap KUnit suite (drivers/base/regmap/regmap-kunit.c) under ARCH=um: 551/551 tests pass, and 551/551 again with lockdep (PROVE_LOCKING, DEBUG_LOCK_ALLOC, DEBUG_ATOMIC_SLEEP) enabled with no splats. Built clean with sparse (C=1) showing no lock-context imbalance warnings. Link: https://patch.msgid.link/20260924-regmap-lock-guard-v3-0-8a6127223c16@nxp.com
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.asm-headers2
-rw-r--r--scripts/generate_rust_target.rs5
-rw-r--r--scripts/livepatch/init.c2
-rwxr-xr-xscripts/mksysmap4
-rw-r--r--scripts/sorttable.c2
5 files changed, 10 insertions, 5 deletions
diff --git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index b38931314ad7..f1c3d287c14b 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -48,7 +48,7 @@ syscall-y := $(addprefix $(obj)/, $(syscall-y))
generated-y := $(addprefix $(obj)/, $(generated-y))
# Remove stale wrappers when the corresponding files are removed from generic-y
-old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
+old-headers := $(shell test -d $(obj) && find $(obj) -name '*.h' ! -name '.*')
unwanted := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
filechk_wrap = echo "\#include <asm-generic/$*.h>"
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 3bf296581a88..7687b0dd5474 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -224,6 +224,11 @@ fn main() {
features += ",+harden-sls-ijmp";
features += ",+harden-sls-ret";
}
+ if cfg.has("X86_NATIVE_CPU") {
+ // Prevent the backend from generating APX instructions. The kernel is not yet prepared
+ // for general in-kernel EGPR use.
+ features += ",-apxf";
+ }
ts.push("features", features);
ts.push("llvm-target", "x86_64-linux-gnu");
ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
diff --git a/scripts/livepatch/init.c b/scripts/livepatch/init.c
index f14d8c8fb35f..16aff8f736eb 100644
--- a/scripts/livepatch/init.c
+++ b/scripts/livepatch/init.c
@@ -51,7 +51,7 @@ static int __init livepatch_mod_init(void)
if (!funcs) {
ret = -ENOMEM;
for (int j = 0; j < i; j++)
- kfree(objs[i].funcs);
+ kfree(objs[j].funcs);
goto err_free_objs;
}
diff --git a/scripts/mksysmap b/scripts/mksysmap
index c4531eacde20..856b26ba2ac0 100755
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -35,7 +35,7 @@
/ __efistub_/d
# arm64 local symbols in PIE namespace
-/ __pi_\\$/d
+/ __pi_\$/d
/ __pi_\.L/d
# arm64 local symbols in non-VHE KVM namespace
@@ -83,7 +83,7 @@
/ _SDA2_BASE_$/d
# MODULE_INFO()
-/ __UNIQUE_ID_modinfo[0-9]*$/d
+/ __UNIQUE_ID_modinfo_[0-9]*$/d
# ---------------------------------------------------------------------------
# Ignored patterns
diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index d8dc2a1b7c31..d7b50581c732 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -116,7 +116,7 @@ static inline void *get_index(void *start, int entsize, int index)
}
static int extable_ent_size;
-static int long_size;
+static int long_size __maybe_unused;
#define ERRSTR_MAXSZ 256