All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Andy Lutomirski <luto@amacapital.net>, Ingo Molnar <mingo@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrey Konovalov <andreyknvl@google.com>,
	Kostya Serebryany <kcc@google.com>,
	Alexander Potapenko <glider@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Borislav Petkov <bp@alien8.de>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] x86/process: Silence KASAN warnings in get_wchan()
Date: Wed, 7 Oct 2015 12:11:05 +0300	[thread overview]
Message-ID: <5614E1A9.60506@virtuozzo.com> (raw)
In-Reply-To: <5614DDD2.3080408@virtuozzo.com>



On 10/07/2015 11:54 AM, Andrey Ryabinin wrote:
> 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
> 

Huh, 'inline' effectively means 'always_inline' on every arch, except x86.
This looks like a bug IMO.
Allowing gcc to uninline functions marked 'inline' could be beneficial for some arches/configs.

$ git grep ARCH_SUPPORTS_OPTIMIZED_INLINING
	arch/tile/Kconfig:config ARCH_SUPPORTS_OPTIMIZED_INLINING
	arch/x86/Kconfig:config ARCH_SUPPORTS_OPTIMIZED_INLINING
	include/linux/compiler-gcc.h:#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) ||           \

$ git grep OPTIMIZE_INLINING
	arch/x86/Kconfig.debug:config OPTIMIZE_INLINING
	arch/x86/configs/i386_defconfig:CONFIG_OPTIMIZE_INLINING=y
	arch/x86/configs/x86_64_defconfig:CONFIG_OPTIMIZE_INLINING=y
	arch/x86/entry/vdso/vdso32/vclock_gettime.c:#undef CONFIG_OPTIMIZE_INLINING
	include/linux/compiler-gcc.h:    !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
	kernel/configs/tiny.config:CONFIG_OPTIMIZE_INLINING=y

  reply	other threads:[~2015-10-07  9:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 10:28 [PATCH] x86/process: Silence KASAN warnings in get_wchan() Andrey Ryabinin
2015-10-05 10:38 ` Dmitry Vyukov
2015-10-05 11:18 ` Borislav Petkov
2015-10-05 11:23 ` Ingo Molnar
2015-10-05 11:39   ` Dmitry Vyukov
2015-10-05 11:46     ` Andrey Ryabinin
2015-10-05 13:15       ` Borislav Petkov
2015-10-05 18:42         ` Andy Lutomirski
2015-10-05 16:39       ` Andi Kleen
2015-10-05 16:59         ` Andrey Ryabinin
2015-10-05 18:58           ` Andi Kleen
2015-10-06  7:26           ` Ingo Molnar
2015-10-06  7:38             ` Andrey Ryabinin
2015-10-06 18:11             ` Andy Lutomirski
2015-10-07  7:22               ` Ingo Molnar
2015-10-07  8:54               ` Andrey Ryabinin
2015-10-07  9:11                 ` Andrey Ryabinin [this message]
2015-10-07 16:27                 ` Andi Kleen
2015-10-07 18:48                   ` Andrey Ryabinin

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=5614E1A9.60506@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wmglo@dent.med.uni-muenchen.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.