mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
modpost: Don't let "driver"s reference .exit.*
commitf177cd0c15
upstream. Drivers must not reference functions marked with __exit as these likely are not available when the code is built-in. There are few creative offenders uncovered for example in ARCH=amd64 allmodconfig builds. So only trigger the section mismatch warning for W=1 builds. The dual rule that drivers must not reference .init.* is implemented since commit0db2524523
("modpost: don't allow *driver to reference .init.*") which however missed that .exit.* should be handled in the same way. 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> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Stable-dep-of:846cfbeed0
("um: Fix adding '-no-pie' for clang") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a5767decf7
commit
999ecc936a
1 changed files with 13 additions and 2 deletions
|
@ -1087,9 +1087,20 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
|
|||
"*_console")))
|
||||
return 0;
|
||||
|
||||
/* symbols in data sections that may refer to meminit/exit sections */
|
||||
/* symbols in data sections that may refer to meminit 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;
|
||||
|
||||
/*
|
||||
* 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(EXIT_SECTIONS)) &&
|
||||
match(fromsym, PATTERNS("*driver")))
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue