diff mbox series

modpost: Don't let "driver"s reference .exit.*

Message ID 20230930140601.2457711-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series modpost: Don't let "driver"s reference .exit.* | expand

Commit Message

Uwe Kleine-König Sept. 30, 2023, 2:06 p.m. UTC
Drivers must not reference functions marked with __exit as these likely
are not available when the code is built-in.

As of v6.6-rc3 building an allyesconfig on arm64, m68k, powerpc, riscv,
s390, sparc64 and x86_64 this now stricter check only triggers for a
single driver (drivers/hwtracing/coresight/coresight-etm4x-core.c). This
one is indeed broken, a fix was already posted
(https://lore.kernel.org/linux-arm-kernel/20230929081637.2377335-1-u.kleine-koenig@pengutronix.de).

This matches commit 0db252452378 ("modpost: don't allow *driver to
reference .init.*") which only handled .init.*.

Thanks to Masahiro Yamada and Arnd Bergmann who gave valuable hints to
find this improvement.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index de499dce5265..b17665e902fc 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1017,7 +1017,7 @@  static int secref_whitelist(const char *fromsec, const char *fromsym,
 
 	/* symbols in data sections that may refer to meminit/exit sections */
 	if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
-	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
+	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
 	    match(fromsym, PATTERNS("*driver")))
 		return 0;