[PATCH] modpost: Enable section warning from *driver to .exit.text

From: Uwe Kleine-König
Date: Tue Jun 11 2024 - 16:59:42 EST


There used to be several offenders, but now that for all of them patches
were sent and most of them were applied, enable the warning also for
builds without W=1.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
---
Hello,

as of v6.10-rc2 there are two known offenders:

- drivers/virt/coco/sev-guest/sev-guest.c
patch submitted in March, available at
https://lore.kernel.org/all/4a81b0e87728a58904283e2d1f18f73abc69c2a1.1711748999.git.u.kleine-koenig@xxxxxxxxxxxxxx

- drivers/parport/parport_amiga.c
fixed in next (commit 73fedc31fed3 ("parport: amiga: Mark driver
struct with __refdata to prevent section mismatch"))

I tested this patch using allmodconfig builds for arm64, riscv, s390 and
x86_64 which didn't expose further drivers with this problem.

In my eyes this is good enough to enable the warning for all builds (and
not only with W=1).

Best regards
Uwe

scripts/mod/modpost.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 937294ff164f..30881d94f00e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -965,17 +965,6 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
match(fromsym, PATTERNS("*_ops", "*_probe", "*_console")))
return 0;

- /*
- * symbols in data sections must not refer to .exit.*, but there are
- * quite a few offenders, so hide these unless for W=1 builds until
- * these are fixed.
- */
- if (!extra_warn &&
- match(fromsec, PATTERNS(DATA_SECTIONS)) &&
- match(tosec, PATTERNS(ALL_EXIT_SECTIONS)) &&
- match(fromsym, PATTERNS("*driver")))
- return 0;
-
/* Check for pattern 3 */
if (strstarts(fromsec, ".head.text") &&
match(tosec, PATTERNS(ALL_INIT_SECTIONS)))

base-commit: c3f38fa61af77b49866b006939479069cd451173
prerequisite-patch-id: 7300dede00db637042647e12d558fe1dd57c20cc
prerequisite-patch-id: 82cfe8597f709f05b9fbbd3e4eca8be35e077e2b
--
2.43.0