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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxx).

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@xxxxxxxxxxxxxx>
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.40.1




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux