diff mbox series

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

Message ID 20240611205900.2145880-2-u.kleine-koenig@baylibre.com (mailing list archive)
State New
Headers show
Series modpost: Enable section warning from *driver to .exit.text | expand

Commit Message

Uwe Kleine-König June 11, 2024, 8:59 p.m. UTC
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@baylibre.com>
---
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@pengutronix.de

 - 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(-)


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

Comments

Nathan Chancellor June 13, 2024, 12:03 a.m. UTC | #1
On Tue, Jun 11, 2024 at 10:59:00PM +0200, Uwe Kleine-König wrote:
> 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@baylibre.com>

Seems reasonable to me, this is just a modpost warning, so it should not
matter too much if there are a few instances lagging behind for a bit
(but it would be good for that to get back on people's radar).

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 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@pengutronix.de
> 
>  - 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
>
Masahiro Yamada June 15, 2024, 6:46 a.m. UTC | #2
On Wed, Jun 12, 2024 at 5:59 AM Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> 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@baylibre.com>


Applied to linux-kbuild.
Thanks!
diff mbox series

Patch

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)))