diff mbox series

[04/10] modpost: remove more symbol patterns from the section check whitelist

Message ID 20231022170613.2072838-4-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [01/10] modpost: remove ALL_EXIT_DATA_SECTIONS macro | expand

Commit Message

Masahiro Yamada Oct. 22, 2023, 5:06 p.m. UTC
These symbol patterns were whitelisted to allow them to reference to
functions with the old __devinit and __devexit annotations.

We stopped doing this a long time ago, for example, commit 6f039790510f
("Drivers: scsi: remove __dev* attributes.") remove those annotations
from the scsi drivers.

Keep *_ops and *_console, otherwise they will really cause section
mismatch warnings.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/mod/modpost.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Nathan Chancellor Oct. 23, 2023, 11:28 p.m. UTC | #1
On Mon, Oct 23, 2023 at 02:06:07AM +0900, Masahiro Yamada wrote:
> These symbol patterns were whitelisted to allow them to reference to
> functions with the old __devinit and __devexit annotations.
> 
> We stopped doing this a long time ago, for example, commit 6f039790510f
> ("Drivers: scsi: remove __dev* attributes.") remove those annotations
> from the scsi drivers.
> 
> Keep *_ops and *_console, otherwise they will really cause section
> mismatch warnings.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/mod/modpost.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 792ba9da0f27..19b138664f75 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -997,13 +997,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
>  	/* symbols in data sections that may refer to any init/exit sections */
>  	if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
>  	    match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
> -	    match(fromsym, PATTERNS("*_template", // scsi uses *_template a lot
> -				    "*_timer", // arm uses ops structures named _timer a lot
> -				    "*_sht", // scsi also used *_sht to some extent
> -				    "*_ops",
> -				    "*_probe",

It seems like this one might still be needed. I see this when building
certain arm64 configurations with clang.

  WARNING: modpost: vmlinux: section mismatch in reference: qcom_irq_combiner_probe+0x0 (section: .data) -> combiner_probe (section: .init.text)

> -				    "*_probe_one",
> -				    "*_console")))
> +	    match(fromsym, PATTERNS("*_ops", "*_console")))
>  		return 0;
>  
>  	/*
> -- 
> 2.40.1
>
Masahiro Yamada Oct. 28, 2023, 11:56 a.m. UTC | #2
On Tue, Oct 24, 2023 at 8:28 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Oct 23, 2023 at 02:06:07AM +0900, Masahiro Yamada wrote:
> > These symbol patterns were whitelisted to allow them to reference to
> > functions with the old __devinit and __devexit annotations.
> >
> > We stopped doing this a long time ago, for example, commit 6f039790510f
> > ("Drivers: scsi: remove __dev* attributes.") remove those annotations
> > from the scsi drivers.
> >
> > Keep *_ops and *_console, otherwise they will really cause section
> > mismatch warnings.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  scripts/mod/modpost.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > index 792ba9da0f27..19b138664f75 100644
> > --- a/scripts/mod/modpost.c
> > +++ b/scripts/mod/modpost.c
> > @@ -997,13 +997,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
> >       /* symbols in data sections that may refer to any init/exit sections */
> >       if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
> >           match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
> > -         match(fromsym, PATTERNS("*_template", // scsi uses *_template a lot
> > -                                 "*_timer", // arm uses ops structures named _timer a lot
> > -                                 "*_sht", // scsi also used *_sht to some extent
> > -                                 "*_ops",
> > -                                 "*_probe",
>
> It seems like this one might still be needed. I see this when building
> certain arm64 configurations with clang.
>
>   WARNING: modpost: vmlinux: section mismatch in reference: qcom_irq_combiner_probe+0x0 (section: .data) -> combiner_probe (section: .init.text)



Thanks for comprehensive compile-testing.


I will keep "*_probe", but I believe __ref is better
if this is only the instance that happens to
have _ops suffix.









> > -                                 "*_probe_one",
> > -                                 "*_console")))
> > +         match(fromsym, PATTERNS("*_ops", "*_console")))
> >               return 0;
> >
> >       /*
> > --
> > 2.40.1
> >
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 792ba9da0f27..19b138664f75 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -997,13 +997,7 @@  static int secref_whitelist(const char *fromsec, const char *fromsym,
 	/* symbols in data sections that may refer to any init/exit sections */
 	if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
 	    match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
-	    match(fromsym, PATTERNS("*_template", // scsi uses *_template a lot
-				    "*_timer", // arm uses ops structures named _timer a lot
-				    "*_sht", // scsi also used *_sht to some extent
-				    "*_ops",
-				    "*_probe",
-				    "*_probe_one",
-				    "*_console")))
+	    match(fromsym, PATTERNS("*_ops", "*_console")))
 		return 0;
 
 	/*