Skip to contentSkip to conversation

scripts/misc-check: update export checks for EXPORT_SYMBOL_FOR_MODULES()

PATCH Applied Vlastimil Babka 4 participants 8 messages Aug 25, 2025 – Aug 26, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/misc-check: update export checks for EXPORT_SYMBOL_FOR_MODULES()

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

---
 scripts/misc-check | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/misc-check +2 -2
index 84f08da17b2c0508b5c2471a6ffb2ab7e36592a4..40e5a4b01ff473a7bfd2fdc156ae06c8cf18f504 100755
@@ -45,7 +45,7 @@ check_tracked_ignored_files () {
 # does not automatically fix it.
 check_missing_include_linux_export_h () {
 
-	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' \
+	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' \
 	    -- '*.[ch]' :^tools/ :^include/linux/export.h |
 	xargs -r git -C "${srctree:-.}" grep --files-without-match '#include[[:space:]]*<linux/export\.h>' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing\n" >&2
@@ -58,7 +58,7 @@ check_unnecessary_include_linux_export_h () {
 
 	git -C "${srctree:-.}" grep --files-with-matches '#include[[:space:]]*<linux/export\.h>' \
 	    -- '*.[c]' :^tools/ |
-	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' |
+	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2
 }
 

---
base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00
change-id: 20250825-export_modules_fix-07d9597f9009

Best regards,

Signature · 1 line
Vlastimil Babka <[email protected]>
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")
Quoted 7 lines

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

---
 scripts/misc-check | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Good catch, thanks a lot! We will gladly take the patch to kbuild-next.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Vlastimil Babka
Quoted 5 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

LGTM,

Quoted 36 lines

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

---
 scripts/misc-check | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/misc-check +2 -3
index 84f08da17b2c0508b5c2471a6ffb2ab7e36592a4..40e5a4b01ff473a7bfd2fdc156ae06c8cf18f504 100755
@@ -45,7 +45,7 @@ check_tracked_ignored_files () {
 # does not automatically fix it.
 check_missing_include_linux_export_h () {
 
-	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' \
+	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' \
 	    -- '*.[ch]' :^tools/ :^include/linux/export.h |
 	xargs -r git -C "${srctree:-.}" grep --files-without-match '#include[[:space:]]*<linux/export\.h>' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing\n" >&2
@@ -58,7 +58,7 @@ check_unnecessary_include_linux_export_h () {
 
 	git -C "${srctree:-.}" grep --files-with-matches '#include[[:space:]]*<linux/export\.h>' \
 	    -- '*.[c]' :^tools/ |
-	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' |
+	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2
 }
 
 
---

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00
change-id: 20250825-export_modules_fix-07d9597f9009

Best regards,

#3 lore raw
In reply to Vlastimil Babka
Quoted 9 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

If this needs to reach Linus's tree to avoid warnings, it could go via another vfs fixes pull request with our ack or we could ask him to pick it up directly (as I am not sure we will have a fixes pull request this cycle). If it is not urgent, I can pick it up via kbuild-next for 6.18. I have no strong preference.

Quoted 35 lines
---
 scripts/misc-check | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/misc-check +2 -3
index 84f08da17b2c0508b5c2471a6ffb2ab7e36592a4..40e5a4b01ff473a7bfd2fdc156ae06c8cf18f504 100755
@@ -45,7 +45,7 @@ check_tracked_ignored_files () {
 # does not automatically fix it.
 check_missing_include_linux_export_h () {
 
-	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' \
+	git -C "${srctree:-.}" grep --files-with-matches -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' \
 	    -- '*.[ch]' :^tools/ :^include/linux/export.h |
 	xargs -r git -C "${srctree:-.}" grep --files-without-match '#include[[:space:]]*<linux/export\.h>' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing\n" >&2
@@ -58,7 +58,7 @@ check_unnecessary_include_linux_export_h () {
 
 	git -C "${srctree:-.}" grep --files-with-matches '#include[[:space:]]*<linux/export\.h>' \
 	    -- '*.[c]' :^tools/ |
-	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_GPL_FOR_MODULES)\(.*\)' |
+	xargs -r git -C "${srctree:-.}" grep --files-without-match -E 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' |
 	xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present\n" >&2
 }
 
 
---

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00
change-id: 20250825-export_modules_fix-07d9597f9009

Best regards,

Signature · 1 line
Vlastimil Babka <[email protected]>
maintainer Acked-by
#4 lore raw
Quoted 11 lines · Nathan Chancellor
Quoted 9 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

Quoted 5 lines

If this needs to reach Linus's tree to avoid warnings, it could go via another vfs fixes pull request with our ack or we could ask him to pick it up directly (as I am not sure we will have a fixes pull request this cycle). If it is not urgent, I can pick it up via kbuild-next for 6.18. I have no strong preference.

Hm, you're right, the check will issue false warnings (and misses to warn when it should) without this update. Therefore I think it would be good to get the patch merged soon - even though the warnings are only issued with W=2.

So, I second asking for the patch to go via vfs fixes or directly via Linus. If it helps:

Kind regards,
Nicolas

#5 lore raw
Quoted 18 lines · Nicolas Schier
Quoted 11 lines · Nathan Chancellor
Quoted 9 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

Quoted 5 lines

If this needs to reach Linus's tree to avoid warnings, it could go via another vfs fixes pull request with our ack or we could ask him to pick it up directly (as I am not sure we will have a fixes pull request this cycle). If it is not urgent, I can pick it up via kbuild-next for 6.18. I have no strong preference.

Quoted 4 lines

Hm, you're right, the check will issue false warnings (and misses to warn when it should) without this update. Therefore I think it would be good to get the patch merged soon - even though the warnings are only issued with W=2.

Note only two files use EXPORT_SYMBOL_FOR_MODULES() in mainline:

fs/anon_inodes.c - contains also EXPORT_SYMBOL_GPL() so the checks will cover it anyway (and IIUC since it includes module.h and not export.h it should be causing a warning already?)

drivers/tty/serial/8250/8250_rsa.c: has no other variants of EXPORT, doesn't include export.h (includes module.h) so this will not trigger unnecessary export.h warning. It should be triggering missing export.h include warning, but will not without this patch.

So IIUC missing this fix results in missing warnings, not adding spurious ones. And there seem to be many existing warnings already. So it doesn't seem that urgent fwiw.

Quoted 2 lines

So, I second asking for the patch to go via vfs fixes or directly via Linus. If it helps:

Let's see what Christian thinks then.

Quoted 4 lines

Kind regards,
Nicolas

#6 lore raw
In reply to Nicolas Schier
Quoted 18 lines · Nicolas Schier
Quoted 11 lines · Nathan Chancellor
Quoted 9 lines · Vlastimil Babka

The module export checks are looking for EXPORT_SYMBOL_GPL_FOR_MODULES() which was renamed to EXPORT_SYMBOL_FOR_MODULES(). Update the checks.

Fixes 6d3c3ca4c77e ("module: Rename EXPORT_SYMBOL_GPL_FOR_MODULES to EXPORT_SYMBOL_FOR_MODULES")

---
I've missed these new checks when renaming the export macro due to my git grep being too narrow. My commit went through Christian's vfs tree but seems the script is part of kbuild (which is currently Odd fixes).

Quoted 5 lines

If this needs to reach Linus's tree to avoid warnings, it could go via another vfs fixes pull request with our ack or we could ask him to pick it up directly (as I am not sure we will have a fixes pull request this cycle). If it is not urgent, I can pick it up via kbuild-next for 6.18. I have no strong preference.

Quoted 4 lines

Hm, you're right, the check will issue false warnings (and misses to warn when it should) without this update. Therefore I think it would be good to get the patch merged soon - even though the warnings are only issued with W=2.

Oh, I forgot that these warnings were downgraded to W=2 in commit a6a7946bd691 ("kbuild: move warnings about linux/export.h from W=1 to W=2")... I thought these were in W=1 still.

In that case, I do not think it is really imperative to fast track this to mainline. We are not and probably never will be W=2 clean so the presence of new or missing warnings is not a big bug to me. I will apply this to kbuild-next later today but I can drop it if someone wants to fast track it.

Cheers,
Nathan