Re: [PATCH] x86/process: Silence KASAN warnings in get_wchan()

From: Andrey Ryabinin
Date: Wed Oct 07 2015 - 04:55:05 EST


On 10/06/2015 09:11 PM, Andy Lutomirski wrote:
>
> But what's wrong with the GCC attribute mechanism? Surely GCC ought
> to be able to generate the code, at least in the simple cases, and the
> attribute already exists. The attribute and READ_ONCE_NOCHECK seem
> like the least messy in the C code.

The problem with 'no_sanitize_address' attribute is incompatibility with inlining.
GCC can't inline function with that attribute into function without it.
And the contrary is also true - GCC can't inline function without attribute into function with such attribute.

Failure to inline always_inline function leads to build failure.
And under CONFIG_OPTIMIZE=n 'inline' means 'always_inline'.

include/linux/compiler-gcc.h:

#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
#define inline inline __attribute__((always_inline)) notrace





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/