From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
dan.carpenter@oracle.com, adilger.kernel@dilger.ca,
yamada.masahiro@socionext.com, michal.lkml@markovi.net,
rostedt@goodmis.org, mchehab+samsung@kernel.org, olof@lxom.net,
Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
David Miller <davem@davemloft.net>,
Kees Cook <keescook@chromium.org>,
tglx@linutronix.de, Ingo Molnar <mingo@kernel.org>,
paullawrence@google.com, sandipan@linux.vnet.ibm.com,
andreyknvl@google.com, David Woodhouse <dwmw2@infradead.org>,
will.deacon@arm.com, Philippe Ombredanne <pombredanne@nexb.com>,
paul.burton@mips.com, rientjes@google.com, w@1wt.eu,
msebor@gmail.com, Chris Li <sparse@chrisli.org>,
Jonathan Corbet <corbet@lwn.net>, "Theodore Ts'o" <tytso@mit.edu>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
joe@perches.com, Arnd Bergmann <arnd@arndb.de>,
asmadeus@codewreck.org, stefan@agner.ch,
luc.vanoostenryck@gmail.com,
Nick Desaulniers <ndesaulniers@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Greg KH <gregkh@linuxfoundation.org>,
linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [GIT PULL] Compiler Attributes for v4.20-rc1
Date: Mon, 5 Nov 2018 14:15:35 +0100 [thread overview]
Message-ID: <20181105141535.7394b16d@mschwideX1> (raw)
In-Reply-To: <20181105070256.52c6fd8f@mschwideX1>
On Mon, 5 Nov 2018 07:02:56 +0100
Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
> On Fri, 2 Nov 2018 09:09:32 -0700
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
> > On Fri, Nov 2, 2018 at 2:43 AM Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> > >
> > > You're right, version checks shouldn't matter here. But __no_sanitize_address_or_inline
> > > shouldn't have been added in the first place, because we already have almost the same
> > >__no_kasan_or_inline:
> >
> > Ahh, very good.
> >
> > Vasily, Martin - since __no_sanitize_address_or_inline was added just
> > for s390, would you mind replacing it with __no_kasan_or_inline
> > instead, and testing that in whatever failed before?
> >
> > Then we can just remove that unnecessary symbol #define entirely..
>
> Ok, will do.
Follow-up question: the __no_sanitize_address_or_inline define has the 'notrace'
option that is missing for __no_kasan_or_inline. We need that option for
__load_psw_mask, if we do the replacement all users of __no_kasan_or_inline
would get the option as well. This affects __read_once_size_nocheck and
read_word_at_a_time. Do these function have to be traceable ?
This patch would work for me:
--
>From 4aaa09fe4b54e930edabac86606dee979b12647c Mon Sep 17 00:00:00 2001
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date: Mon, 5 Nov 2018 07:36:28 +0100
Subject: [PATCH] compiler: remove __no_sanitize_address_or_inline again
The __no_sanitize_address_or_inline and __no_kasan_or_inline defines
are almost identical. The only difference is that __no_kasan_or_inline
does not have the 'notrace' attribute.
To be able to replace __no_sanitize_address_or_inline with the older
definition, add 'notrace' to __no_kasan_or_inline and change to two
users of __no_sanitize_address_or_inline in the s390 code.
The 'notrace' option is necessary for e.g. the __load_psw_mask function
in arch/s390/include/asm/processor.h. Without the option it is possible
to trace __load_psw_mask which leads to kernel stack overflow.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/include/asm/processor.h | 4 ++--
include/linux/compiler-gcc.h | 12 ------------
include/linux/compiler.h | 2 +-
3 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 302795c47c06..81038ab357ce 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -236,7 +236,7 @@ static inline unsigned long current_stack_pointer(void)
return sp;
}
-static __no_sanitize_address_or_inline unsigned short stap(void)
+static __no_kasan_or_inline unsigned short stap(void)
{
unsigned short cpu_address;
@@ -330,7 +330,7 @@ static inline void __load_psw(psw_t psw)
* Set PSW mask to specified value, while leaving the
* PSW addr pointing to the next instruction.
*/
-static __no_sanitize_address_or_inline void __load_psw_mask(unsigned long mask)
+static __no_kasan_or_inline void __load_psw_mask(unsigned long mask)
{
unsigned long addr;
psw_t psw;
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index c0f5db3a9621..2010493e1040 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -143,18 +143,6 @@
#define KASAN_ABI_VERSION 3
#endif
-/*
- * Because __no_sanitize_address conflicts with inlining:
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
- * we do one or the other.
- */
-#ifdef CONFIG_KASAN
-#define __no_sanitize_address_or_inline \
- __no_sanitize_address __maybe_unused notrace
-#else
-#define __no_sanitize_address_or_inline inline
-#endif
-
#if GCC_VERSION >= 50100
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 18c80cfa4fc4..06396c1cf127 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -189,7 +189,7 @@ void __read_once_size(const volatile void *p, void *res, int size)
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
* '__maybe_unused' allows us to avoid defined-but-not-used warnings.
*/
-# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
+# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
#else
# define __no_kasan_or_inline __always_inline
#endif
--
2.16.4
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2018-11-05 22:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-22 10:59 [GIT PULL] Compiler Attributes for v4.20-rc1 Miguel Ojeda
2018-11-01 17:06 ` Linus Torvalds
2018-11-01 20:15 ` Miguel Ojeda
2018-11-02 1:46 ` Linus Torvalds
2018-11-02 10:13 ` Miguel Ojeda
2018-11-02 13:17 ` Andrey Ryabinin
2018-11-02 16:11 ` Linus Torvalds
2018-11-02 16:59 ` Andrey Ryabinin
2018-11-02 9:44 ` Andrey Ryabinin
2018-11-02 16:09 ` Linus Torvalds
2018-11-05 6:02 ` Martin Schwidefsky
2018-11-05 13:15 ` Martin Schwidefsky [this message]
2018-11-05 14:31 ` Steven Rostedt
2018-11-05 16:14 ` Linus Torvalds
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=20181105141535.7394b16d@mschwideX1 \
--to=schwidefsky@de.ibm.com \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=arnd@arndb.de \
--cc=aryabinin@virtuozzo.com \
--cc=asmadeus@codewreck.org \
--cc=corbet@lwn.net \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dwmw2@infradead.org \
--cc=geert@linux-m68k.org \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=konstantin@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=luc.vanoostenryck@gmail.com \
--cc=mchehab+samsung@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@kernel.org \
--cc=msebor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=olof@lxom.net \
--cc=paul.burton@mips.com \
--cc=paullawrence@google.com \
--cc=pombredanne@nexb.com \
--cc=rientjes@google.com \
--cc=rostedt@goodmis.org \
--cc=sandipan@linux.vnet.ibm.com \
--cc=sparse@chrisli.org \
--cc=stefan@agner.ch \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=w@1wt.eu \
--cc=will.deacon@arm.com \
--cc=yamada.masahiro@socionext.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;
as well as URLs for NNTP newsgroup(s).