Skip to contentSkip to conversation

modpost: Make static exports fatal

PATCH In review Quentin Perret 4 participants 5 messages Nov 24, 2020 – Dec 1, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modpost: Make static exports fatal

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to fatal() to make sure this never happens again.

---
 scripts/mod/modpost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +3 -3
index f882ce0d9327..70b0e825a139 100644
@@ -2663,9 +2663,9 @@ int main(int argc, char **argv)
 
 		for (s = symbolhash[n]; s; s = s->next) {
 			if (s->is_static)
-				warn("\"%s\" [%s] is a static %s\n",
-				     s->name, s->module->name,
-				     export_str(s->export));
+				fatal("\"%s\" [%s] is a static %s\n",
+				      s->name, s->module->name,
+				      export_str(s->export));
 		}
 	}
 
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Quentin Perret

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to fatal() to make sure this never happens again.

---
 scripts/mod/modpost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +0 -0
index f882ce0d9327..70b0e825a139 100644
@@ -2663,9 +2663,9 @@ int main(int argc, char **argv)
 
 		for (s = symbolhash[n]; s; s = s->next) {

scripts/mod/modpost.c int main(int argc, char **argv) · line 2671

Quoted 10 lines
scripts/mod/modpost.c +3 -3
 			if (s->is_static)
-				warn("\"%s\" [%s] is a static %s\n",
-				     s->name, s->module->name,
-				     export_str(s->export));
+				fatal("\"%s\" [%s] is a static %s\n",
+				      s->name, s->module->name,
+				      export_str(s->export));
 		}
 	}
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Quentin Perret
Quoted 7 lines · Quentin Perret

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to fatal() to make sure this never happens again.

Cheers,
Matthias

Quoted 24 lines

---
scripts/mod/modpost.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +3 -3
index f882ce0d9327..70b0e825a139 100644
@@ -2663,9 +2663,9 @@ int main(int argc, char **argv)
 
 		for (s = symbolhash[n]; s; s = s->next) {
 			if (s->is_static)
-				warn("\"%s\" [%s] is a static %s\n",
-				     s->name, s->module->name,
-				     export_str(s->export));
+				fatal("\"%s\" [%s] is a static %s\n",
+				      s->name, s->module->name,
+				      export_str(s->export));
 		}
 	}
 
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
#3 lore raw
In reply to Quentin Perret
Quoted 30 lines · Quentin Perret

Using EXPORT_SYMBOL*() on static functions is fundamentally wrong. Modpost currently reports that as a warning, but clearly this is not a pattern we should allow, and all in-tree occurences should have been fixed by now. So, promote the warn() message to fatal() to make sure this never happens again.

---
 scripts/mod/modpost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/mod/modpost.c +3 -4
index f882ce0d9327..70b0e825a139 100644
@@ -2663,9 +2663,9 @@ int main(int argc, char **argv)
 
                for (s = symbolhash[n]; s; s = s->next) {
                        if (s->is_static)
-                               warn("\"%s\" [%s] is a static %s\n",
-                                    s->name, s->module->name,
-                                    export_str(s->export));
+                               fatal("\"%s\" [%s] is a static %s\n",
+                                     s->name, s->module->name,
+                                     export_str(s->export));
                }
        }
 
--
Quoted 2 lines

2.29.2.454.gaff20da3a2-goog

I am not a big fan of (ab)using fatal() for this case.

Please consider using error() once
the following is queued up.

https://patchwork.kernel.org/project/linux-kbuild/patch/[email protected]/

Signature · 2 lines
Best Regards
Masahiro Yamada