All of lore.kernel.org
 help / color / mirror / Atom feed
* static EXPORT_SYMBOL checker causes false positives on ARCH=um
@ 2019-09-24  8:17 ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2019-09-24  8:17 UTC (permalink / raw)
  To: linux-kernel, linux-um, Denis Efremov, Masahiro Yamada, Emil Velikov
  Cc: linux-kbuild

Hi,

With the new commit 15bfc2348d54 ("modpost: check for static
EXPORT_SYMBOL* functions") we get a lot of warnings on ARCH=um builds:

WARNING: "rename" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "lseek" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "ftruncate64" [vmlinux] is a static EXPORT_SYMBOL
[...]
see https://p.sipsolutions.net/7232995f34907b9d.txt


This hack fixes *most* of them:

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 820eed87fb43..3e443563ebea 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1931,12 +1931,18 @@ static void check_sec_ref(struct module *mod, const char *modname,
 static char *remove_dot(char *s)
 {
 	size_t n = strcspn(s, ".");
+	char *at;
 
 	if (n && s[n]) {
 		size_t m = strspn(s + n + 1, "0123456789");
 		if (m && (s[n + m] == '.' || s[n + m] == 0))
 			s[n] = 0;
 	}
+
+	at = strchr(s, '@');
+	if (at)
+		*at = 0;
+
 	return s;
 }
 

(but obviously just serves to give you an idea of what's going on).


With that, only two remain for me:

WARNING: "__guard" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "__stack_smash_handler" [vmlinux] is a static EXPORT_SYMBOL

and I think that's because they don't even exist at all, so arguably the
code shouldn't export them, but I didn't find a way to detect at build
time if -fstack-protector was enabled or not?

Any thoughts?

Thanks,
johannes


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* static EXPORT_SYMBOL checker causes false positives on ARCH=um
@ 2019-09-24  8:17 ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2019-09-24  8:17 UTC (permalink / raw)
  To: linux-kernel, linux-um, Denis Efremov, Masahiro Yamada, Emil Velikov
  Cc: linux-kbuild

Hi,

With the new commit 15bfc2348d54 ("modpost: check for static
EXPORT_SYMBOL* functions") we get a lot of warnings on ARCH=um builds:

WARNING: "rename" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "lseek" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "ftruncate64" [vmlinux] is a static EXPORT_SYMBOL
[...]
see https://p.sipsolutions.net/7232995f34907b9d.txt


This hack fixes *most* of them:

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 820eed87fb43..3e443563ebea 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1931,12 +1931,18 @@ static void check_sec_ref(struct module *mod, const char *modname,
 static char *remove_dot(char *s)
 {
 	size_t n = strcspn(s, ".");
+	char *at;
 
 	if (n && s[n]) {
 		size_t m = strspn(s + n + 1, "0123456789");
 		if (m && (s[n + m] == '.' || s[n + m] == 0))
 			s[n] = 0;
 	}
+
+	at = strchr(s, '@');
+	if (at)
+		*at = 0;
+
 	return s;
 }
 

(but obviously just serves to give you an idea of what's going on).


With that, only two remain for me:

WARNING: "__guard" [vmlinux] is a static EXPORT_SYMBOL
WARNING: "__stack_smash_handler" [vmlinux] is a static EXPORT_SYMBOL

and I think that's because they don't even exist at all, so arguably the
code shouldn't export them, but I didn't find a way to detect at build
time if -fstack-protector was enabled or not?

Any thoughts?

Thanks,
johannes


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: static EXPORT_SYMBOL checker causes false positives on ARCH=um
  2019-09-24  8:17 ` Johannes Berg
@ 2019-09-24 12:09   ` Masahiro Yamada
  -1 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-09-24 12:09 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Linux Kernel Mailing List, linux-um, Denis Efremov, Emil Velikov,
	Linux Kbuild mailing list

Hi Johannes,

On Tue, Sep 24, 2019 at 5:17 PM Johannes Berg <johannes@sipsolutions.net> wrote:
>
> Hi,
>
> With the new commit 15bfc2348d54 ("modpost: check for static
> EXPORT_SYMBOL* functions") we get a lot of warnings on ARCH=um builds:
>
> WARNING: "rename" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "lseek" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "ftruncate64" [vmlinux] is a static EXPORT_SYMBOL
> [...]
> see https://p.sipsolutions.net/7232995f34907b9d.txt

Thanks for the report.

I think this should work:
https://lore.kernel.org/patchwork/patch/1131017/

It fixes "__guard" and "__stack_smash_handler" too.


Thanks.



>
>
> This hack fixes *most* of them:
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 820eed87fb43..3e443563ebea 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1931,12 +1931,18 @@ static void check_sec_ref(struct module *mod, const char *modname,
>  static char *remove_dot(char *s)
>  {
>         size_t n = strcspn(s, ".");
> +       char *at;
>
>         if (n && s[n]) {
>                 size_t m = strspn(s + n + 1, "0123456789");
>                 if (m && (s[n + m] == '.' || s[n + m] == 0))
>                         s[n] = 0;
>         }
> +
> +       at = strchr(s, '@');
> +       if (at)
> +               *at = 0;
> +
>         return s;
>  }
>
>
> (but obviously just serves to give you an idea of what's going on).
>
>
> With that, only two remain for me:
>
> WARNING: "__guard" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "__stack_smash_handler" [vmlinux] is a static EXPORT_SYMBOL
>
> and I think that's because they don't even exist at all, so arguably the
> code shouldn't export them, but I didn't find a way to detect at build
> time if -fstack-protector was enabled or not?
>
> Any thoughts?
>
> Thanks,
> johannes
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: static EXPORT_SYMBOL checker causes false positives on ARCH=um
@ 2019-09-24 12:09   ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2019-09-24 12:09 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Emil Velikov, linux-um, Linux Kernel Mailing List, Denis Efremov,
	Linux Kbuild mailing list

Hi Johannes,

On Tue, Sep 24, 2019 at 5:17 PM Johannes Berg <johannes@sipsolutions.net> wrote:
>
> Hi,
>
> With the new commit 15bfc2348d54 ("modpost: check for static
> EXPORT_SYMBOL* functions") we get a lot of warnings on ARCH=um builds:
>
> WARNING: "rename" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "lseek" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "ftruncate64" [vmlinux] is a static EXPORT_SYMBOL
> [...]
> see https://p.sipsolutions.net/7232995f34907b9d.txt

Thanks for the report.

I think this should work:
https://lore.kernel.org/patchwork/patch/1131017/

It fixes "__guard" and "__stack_smash_handler" too.


Thanks.



>
>
> This hack fixes *most* of them:
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 820eed87fb43..3e443563ebea 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1931,12 +1931,18 @@ static void check_sec_ref(struct module *mod, const char *modname,
>  static char *remove_dot(char *s)
>  {
>         size_t n = strcspn(s, ".");
> +       char *at;
>
>         if (n && s[n]) {
>                 size_t m = strspn(s + n + 1, "0123456789");
>                 if (m && (s[n + m] == '.' || s[n + m] == 0))
>                         s[n] = 0;
>         }
> +
> +       at = strchr(s, '@');
> +       if (at)
> +               *at = 0;
> +
>         return s;
>  }
>
>
> (but obviously just serves to give you an idea of what's going on).
>
>
> With that, only two remain for me:
>
> WARNING: "__guard" [vmlinux] is a static EXPORT_SYMBOL
> WARNING: "__stack_smash_handler" [vmlinux] is a static EXPORT_SYMBOL
>
> and I think that's because they don't even exist at all, so arguably the
> code shouldn't export them, but I didn't find a way to detect at build
> time if -fstack-protector was enabled or not?
>
> Any thoughts?
>
> Thanks,
> johannes
>


-- 
Best Regards
Masahiro Yamada

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-24 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24  8:17 static EXPORT_SYMBOL checker causes false positives on ARCH=um Johannes Berg
2019-09-24  8:17 ` Johannes Berg
2019-09-24 12:09 ` Masahiro Yamada
2019-09-24 12:09   ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.