From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148AbbJGJNT (ORCPT ); Wed, 7 Oct 2015 05:13:19 -0400 Received: from relay.parallels.com ([195.214.232.42]:45993 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752809AbbJGJLR (ORCPT ); Wed, 7 Oct 2015 05:11:17 -0400 Subject: Re: [PATCH] x86/process: Silence KASAN warnings in get_wchan() To: Andy Lutomirski , Ingo Molnar References: <1444040906-6788-1-git-send-email-aryabinin@virtuozzo.com> <20151005112341.GA1101@gmail.com> <56126316.3030901@virtuozzo.com> <20151005163906.GE26924@tassilo.jf.intel.com> <5612AC7A.9080502@virtuozzo.com> <20151006072655.GB10672@gmail.com> <5614DDD2.3080408@virtuozzo.com> CC: Andi Kleen , Dmitry Vyukov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "x86@kernel.org" , LKML , Andrey Konovalov , Kostya Serebryany , Alexander Potapenko , kasan-dev , Borislav Petkov , Denys Vlasenko , Sasha Levin , Wolfram Gloger , Linus Torvalds , Andrew Morton From: Andrey Ryabinin Message-ID: <5614E1A9.60506@virtuozzo.com> Date: Wed, 7 Oct 2015 12:11:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <5614DDD2.3080408@virtuozzo.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH.sw.swsoft.com (10.255.249.47) To MSK-EXCH1.sw.swsoft.com (10.67.48.55) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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