Thread (24 messages) 24 messages, 5 authors, 2017-10-27

Re: [PATCH v4 4/9] em28xx: fix em28xx_dvb_init for KASAN

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-10-02 08:33:43
Also in: linux-kbuild, linux-media, linux-wireless, lkml, stable

On Thu, Sep 28, 2017 at 4:30 PM, Arnd Bergmann [off-list ref] wrote:
On Thu, Sep 28, 2017 at 6:09 AM, Andrey Ryabinin
[off-list ref] wrote:
quoted
On 09/27/2017 04:26 PM, Arnd Bergmann wrote:
quoted
On Tue, Sep 26, 2017 at 9:49 AM, Andrey Ryabinin
[off-list ref] wrote:
quoted
quoted
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -227,7 +227,7 @@ static inline const char *kbasename(const char *path)
 #define __FORTIFY_INLINE extern __always_inline __attribute__((gnu_inline))
 #define __RENAME(x) __asm__(#x)

-void fortify_panic(const char *name) __noreturn __cold;
+void fortify_panic(const char *name) __cold;
 void __read_overflow(void) __compiletime_error("detected read beyond
size of object passed as 1st parameter");
 void __read_overflow2(void) __compiletime_error("detected read beyond
size of object passed as 2nd parameter");
 void __read_overflow3(void) __compiletime_error("detected read beyond
size of object passed as 3rd parameter");

I don't immediately see why the __noreturn changes the behavior here, any idea?

At first I thought that this somehow might be related to __asan_handle_no_return(). GCC calls it
before noreturn function. So I made patch to remove generation of these calls (we don't need them in the kernel anyway)
but it didn't help. It must be something else than.
I made a reduced test case yesterday (see http://paste.ubuntu.com/25628030/),
and it shows the same behavior with and without the sanitizer, it uses 128
bytes without the noreturn attribute and 480 bytes when its added, the sanitizer
adds a factor of 1.5x on top. It's possible that I did something wrong while
reducing, since the original driver file uses very little stack (a few hundred
bytes) without -fsanitize=kernel-address, but finding out what happens in
the reduced case may still help understand the other one.
This is now GCC PR82365, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365

I've come up with a workaround, but I'm not sure if that is any better than the
alternatives, will send the patch as a follow-up in a bit.

     Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help