linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: dummy-tools: adjust to stricter stackprotector check
@ 2021-05-15 10:11 Michal Kubecek
  2021-05-17  2:48 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Kubecek @ 2021-05-15 10:11 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild
  Cc: Michal Marek, Andy Lutomirski, Borislav Petkov, linux-kernel

Commit 3fb0fdb3bbe7 ("x86/stackprotector/32: Make the canary into a regular
percpu variable") modified the stackprotector check on 32-bit x86 to check
if gcc supports using %fs as canary. Adjust dummy-tools gcc script to pass
this new test by returning "%fs" rather than "%gs" if it detects
-mstack-protector-guard-reg=fs on command line.

Fixes: 3fb0fdb3bbe7 ("x86/stackprotector/32: Make the canary into a regular percpu variable")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 scripts/dummy-tools/gcc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
index f6d543725f1e..b2483149bbe5 100755
--- a/scripts/dummy-tools/gcc
+++ b/scripts/dummy-tools/gcc
@@ -76,7 +76,11 @@ fi
 if arg_contain -S "$@"; then
 	# For scripts/gcc-x86-*-has-stack-protector.sh
 	if arg_contain -fstack-protector "$@"; then
-		echo "%gs"
+		if arg_contain -mstack-protector-guard-reg=fs "$@"; then
+			echo "%fs"
+		else
+			echo "%gs"
+		fi
 		exit 0
 	fi
 
-- 
2.31.1


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

* Re: [PATCH] kbuild: dummy-tools: adjust to stricter stackprotector check
  2021-05-15 10:11 [PATCH] kbuild: dummy-tools: adjust to stricter stackprotector check Michal Kubecek
@ 2021-05-17  2:48 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2021-05-17  2:48 UTC (permalink / raw)
  To: Michal Kubecek
  Cc: Linux Kbuild mailing list, Michal Marek, Andy Lutomirski,
	Borislav Petkov, Linux Kernel Mailing List

On Sat, May 15, 2021 at 7:58 PM Michal Kubecek <mkubecek@suse.cz> wrote:
>
> Commit 3fb0fdb3bbe7 ("x86/stackprotector/32: Make the canary into a regular
> percpu variable") modified the stackprotector check on 32-bit x86 to check
> if gcc supports using %fs as canary. Adjust dummy-tools gcc script to pass
> this new test by returning "%fs" rather than "%gs" if it detects
> -mstack-protector-guard-reg=fs on command line.
>
> Fixes: 3fb0fdb3bbe7 ("x86/stackprotector/32: Make the canary into a regular percpu variable")
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>


Applied to linux-kbuild/fixes.
Thanks.

> ---
>  scripts/dummy-tools/gcc | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
> index f6d543725f1e..b2483149bbe5 100755
> --- a/scripts/dummy-tools/gcc
> +++ b/scripts/dummy-tools/gcc
> @@ -76,7 +76,11 @@ fi
>  if arg_contain -S "$@"; then
>         # For scripts/gcc-x86-*-has-stack-protector.sh
>         if arg_contain -fstack-protector "$@"; then
> -               echo "%gs"
> +               if arg_contain -mstack-protector-guard-reg=fs "$@"; then
> +                       echo "%fs"
> +               else
> +                       echo "%gs"
> +               fi
>                 exit 0
>         fi
>
> --
> 2.31.1
>


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2021-05-17  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 10:11 [PATCH] kbuild: dummy-tools: adjust to stricter stackprotector check Michal Kubecek
2021-05-17  2:48 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).