From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>,
Jesper Nilsson <jesper.nilsson@axis.com>,
Tony Luck <tony.luck@intel.com>,
Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>,
"linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Christopher Li <sparse@chrisli.org>,
Mark Rutland <mark.rutland@arm.com>,
Will Deacon <will.deacon@arm.com>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>, Mikael Starvik <starvik@axis.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
arcml <linux-snps-arc@lists.infradead.org>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] bug.h: Work around GCC PR82365 in BUG()
Date: Wed, 21 Feb 2018 13:23:52 -0800 [thread overview]
Message-ID: <2d57e8c6-069c-c4b7-0eb2-6abb8fa2181f@synopsys.com> (raw)
In-Reply-To: <e35cd0ea-b1b1-b8a1-6d01-6a17da091407@synopsys.com>
On 02/07/2018 05:20 PM, Vineet Gupta wrote:
>
>> Didn't do ;)
>>
>> Is Arnd's patch good to merge or do we need a fixup?
>>
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>> Subject: bug.h: work around GCC PR82365 in BUG()
>>
>> Looking at functions with large stack frames across all architectures led
>> me discovering that BUG() suffers from the same problem as
>> fortify_panic(), which I've added a workaround for already. In short,
>> variables that go out of scope by calling a noreturn function or
>> __builtin_unreachable() keep using stack space in functions afterwards.
>>
>> A workaround that was identified is to insert an empty assembler statement
>> just before calling the function that doesn't return. I'm adding a macro
>> "barrier_before_unreachable()" to document this, and insert calls to that
>> in all instances of BUG() that currently suffer from this problem.
>>
..
..
>> ---
>>
>> arch/arc/include/asm/bug.h | 3 ++-
>> arch/cris/include/arch-v10/arch/bug.h | 11 +++++++++--
>> arch/ia64/include/asm/bug.h | 6 +++++-
>> arch/m68k/include/asm/bug.h | 3 +++
>> arch/sparc/include/asm/bug.h | 6 +++++-
>> include/asm-generic/bug.h | 1 +
>> include/linux/compiler-gcc.h | 15 ++++++++++++++-
>> include/linux/compiler.h | 5 +++++
>> 8 files changed, 44 insertions(+), 6 deletions(-)
>>
>> diff -puN arch/arc/include/asm/bug.h~bugh-work-around-gcc-pr82365-in-bug
>> arch/arc/include/asm/bug.h
>> --- a/arch/arc/include/asm/bug.h~bugh-work-around-gcc-pr82365-in-bug
>> +++ a/arch/arc/include/asm/bug.h
>> @@ -23,7 +23,8 @@ void die(const char *str, struct pt_regs
>> #define BUG() do { \
>> pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
>> - dump_stack(); \
>> + barrier_before_unreachable(); \
>> + __builtin_trap(); \
>> } while (0)
>
> For ARC, it is double win.
>
> 1. Fixes 3 -Wreturn-type warnings
>
> | ../net/core/ethtool.c:311:1: warning: control reaches end of non-void function
> [-Wreturn-type]
> | ../kernel/sched/core.c:3246:1: warning: control reaches end of non-void
> function [-Wreturn-type]
> | ../include/linux/sunrpc/svc_xprt.h:180:1: warning: control reaches end of
> non-void function [-Wreturn-type]
>
> 2. bloat-o-meter reports code size improvements as gcc elides the generated code
> for stack return.
>
>
> Acked-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
> Tested-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
Ping ?
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
Mikael Starvik <starvik@axis.com>,
Jesper Nilsson <jesper.nilsson@axis.com>,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
"David S. Miller" <davem@davemloft.net>,
Christopher Li <sparse@chrisli.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Kees Cook <keescook@chromium.org>, Ingo Molnar <mingo@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Will Deacon <will.deacon@arm.com>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Mark Rutland <mark.rutland@arm.com>,
arcml <linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH] bug.h: Work around GCC PR82365 in BUG()
Date: Wed, 21 Feb 2018 13:23:52 -0800 [thread overview]
Message-ID: <2d57e8c6-069c-c4b7-0eb2-6abb8fa2181f@synopsys.com> (raw)
Message-ID: <20180221212352.rvL6xGy8MvDzPTwNHuJFJzF3fdu2KtqG23hH42YZ8QM@z> (raw)
In-Reply-To: <e35cd0ea-b1b1-b8a1-6d01-6a17da091407@synopsys.com>
On 02/07/2018 05:20 PM, Vineet Gupta wrote:
>
>> Didn't do ;)
>>
>> Is Arnd's patch good to merge or do we need a fixup?
>>
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>> Subject: bug.h: work around GCC PR82365 in BUG()
>>
>> Looking at functions with large stack frames across all architectures led
>> me discovering that BUG() suffers from the same problem as
>> fortify_panic(), which I've added a workaround for already. In short,
>> variables that go out of scope by calling a noreturn function or
>> __builtin_unreachable() keep using stack space in functions afterwards.
>>
>> A workaround that was identified is to insert an empty assembler statement
>> just before calling the function that doesn't return. I'm adding a macro
>> "barrier_before_unreachable()" to document this, and insert calls to that
>> in all instances of BUG() that currently suffer from this problem.
>>
..
..
>> ---
>>
>> arch/arc/include/asm/bug.h | 3 ++-
>> arch/cris/include/arch-v10/arch/bug.h | 11 +++++++++--
>> arch/ia64/include/asm/bug.h | 6 +++++-
>> arch/m68k/include/asm/bug.h | 3 +++
>> arch/sparc/include/asm/bug.h | 6 +++++-
>> include/asm-generic/bug.h | 1 +
>> include/linux/compiler-gcc.h | 15 ++++++++++++++-
>> include/linux/compiler.h | 5 +++++
>> 8 files changed, 44 insertions(+), 6 deletions(-)
>>
>> diff -puN arch/arc/include/asm/bug.h~bugh-work-around-gcc-pr82365-in-bug
>> arch/arc/include/asm/bug.h
>> --- a/arch/arc/include/asm/bug.h~bugh-work-around-gcc-pr82365-in-bug
>> +++ a/arch/arc/include/asm/bug.h
>> @@ -23,7 +23,8 @@ void die(const char *str, struct pt_regs
>> #define BUG() do { \
>> pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
>> - dump_stack(); \
>> + barrier_before_unreachable(); \
>> + __builtin_trap(); \
>> } while (0)
>
> For ARC, it is double win.
>
> 1. Fixes 3 -Wreturn-type warnings
>
> | ../net/core/ethtool.c:311:1: warning: control reaches end of non-void function
> [-Wreturn-type]
> | ../kernel/sched/core.c:3246:1: warning: control reaches end of non-void
> function [-Wreturn-type]
> | ../include/linux/sunrpc/svc_xprt.h:180:1: warning: control reaches end of
> non-void function [-Wreturn-type]
>
> 2. bloat-o-meter reports code size improvements as gcc elides the generated code
> for stack return.
>
>
> Acked-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
> Tested-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
Ping ?
next prev parent reply other threads:[~2018-02-21 21:23 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-19 11:39 [PATCH] bug.h: Work around GCC PR82365 in BUG() Arnd Bergmann
2017-12-19 11:39 ` Arnd Bergmann
2017-12-19 11:49 ` Geert Uytterhoeven
2017-12-19 11:49 ` Geert Uytterhoeven
2017-12-19 16:57 ` Vineet Gupta
2017-12-19 16:57 ` Vineet Gupta
2017-12-19 20:13 ` Arnd Bergmann
2017-12-19 20:13 ` Arnd Bergmann
2017-12-19 22:38 ` Vineet Gupta
2017-12-19 22:38 ` Vineet Gupta
2017-12-20 9:01 ` Arnd Bergmann
2017-12-20 9:01 ` Arnd Bergmann
2017-12-20 18:52 ` Vineet Gupta
2017-12-20 18:52 ` Vineet Gupta
2017-12-20 20:12 ` Arnd Bergmann
2017-12-20 20:12 ` Arnd Bergmann
2017-12-20 20:29 ` Vineet Gupta
2017-12-20 20:29 ` Vineet Gupta
2018-02-08 0:01 ` Andrew Morton
2018-02-08 0:01 ` Andrew Morton
2018-02-08 0:51 ` Vineet Gupta
2018-02-08 0:51 ` Vineet Gupta
2018-02-08 1:20 ` Vineet Gupta
2018-02-08 1:20 ` Vineet Gupta
2018-02-21 21:23 ` Vineet Gupta [this message]
2018-02-21 21:23 ` Vineet Gupta
2018-04-10 22:48 ` James Hogan
2018-04-10 22:48 ` James Hogan
2018-04-11 7:30 ` Arnd Bergmann
2018-04-11 7:30 ` Arnd Bergmann
2018-04-11 9:54 ` James Hogan
2018-04-11 9:54 ` James Hogan
2018-04-11 10:08 ` Arnd Bergmann
2018-04-11 10:08 ` Arnd Bergmann
2018-04-11 10:19 ` James Hogan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d57e8c6-069c-c4b7-0eb2-6abb8fa2181f@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=fenghua.yu@intel.com \
--cc=geert@linux-m68k.org \
--cc=jesper.nilsson@axis.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sparse@chrisli.org \
--cc=starvik@axis.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox