Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8261475ybi; Tue, 9 Jul 2019 12:10:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQmLVYHQ2N66HnnpeAbZRksREtCgBo5z4UbXaNQEtne0IJvkKzs9a/Z6ZlFcc1GxUHjODb X-Received: by 2002:a17:902:2baa:: with SMTP id l39mr34415970plb.280.1562699458227; Tue, 09 Jul 2019 12:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562699458; cv=none; d=google.com; s=arc-20160816; b=jfqbUI32/jUmjT7EEFXvYvPvcOoZV98pm3IPw6liXaB3KRrIFjWHVWnIPF7QWxTgxb WXFQwz8ztg6YnA5g/ObMOA5RWFfYpuhUccU9LJpX8utkb1PAlHPjcJfFXAM+/inTYuXu sBvso2pWR4sCW64Qfy4PAGNUVWBn4iAfY4SAk4IOcsmOSXiGw7YQfJrOeMWpbgDWGqoy RhZoMwrRx8oRzf3XR5Qc+++xl1tNEKGrcMx7uC4rQZrgO9gc4c/iuRi64kLKOu9f5aTf h4qTSDoCKngNDj4Bj0s8dvgZjuLPAy45TAkFSm0tmz9KK3J8jdxUu6WIT4pjSF5cSsxC Y3Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Zm4J8N0L6YVDhgceNjwFTRje/qtdyRaa2MpVNyZc04Q=; b=xNON9Y2gdjNCBkbMTGdu4ATYNXN4dSF4OJBU/2V//rz2V3Akv70gHUVkbUaNwCglQB j+NaWM2dpkrc2ggmSOusFPddZ/CS9lxWrMrgpJpnp/KzYzppHd0t5Vl2jCVCLJ/QZIU+ hT7RaAWcYf+PfeafVIaY9g0cLloCf/eI9+WP1AN+KNhQYx9K+BTBm2V4pyujhD4Dbmcd RsZzrzYY0KtqSBI1n4LhAiBHs7540fyBS9BU9Ri8l5+DdHUPS0Uw8yktuiSlrvU36Z1p j28CYx4J6kCGGZveshNNAp2BFsDKpr4MU/cF4VGRXg2c+8s2kF3CGILIKDH+ji9xugyR PNZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TqfgNa9j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m129si2456648pfm.15.2019.07.09.12.10.42; Tue, 09 Jul 2019 12:10:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TqfgNa9j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbfGISwB (ORCPT + 99 others); Tue, 9 Jul 2019 14:52:01 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37390 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbfGISwB (ORCPT ); Tue, 9 Jul 2019 14:52:01 -0400 Received: by mail-pg1-f193.google.com with SMTP id g15so9906397pgi.4 for ; Tue, 09 Jul 2019 11:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zm4J8N0L6YVDhgceNjwFTRje/qtdyRaa2MpVNyZc04Q=; b=TqfgNa9jexrjOJ6gY7s0A3tn6HxV+ZEzz7+cwfk326AguSsXA7PzEdvnt7bJqMSReI R5JrO62B6b7M7yK/xWNTmryCGtU50i3KXJ5y6fZQTTeSBC5AHZrUwEUcwJt6BnBJpKaA 3Y5w/wdmDZn16MhFHyI4tbNPqO47vZSvrVDietwwzO9BJIIvzZiLi+QQqsM8H1wVSVIc zO4pDu0GVLIP6esKnNIrmoCIyRreebxSS79Ubof8J55S/OIa+lUxu7wy9+nFgZ179ywn 38PsRvHbIPE1mbb160DHNhrc7QIYaIdU8+nsAAn1wVaPLqb5YKNNaZdnPR9/vaMZuorq WjxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zm4J8N0L6YVDhgceNjwFTRje/qtdyRaa2MpVNyZc04Q=; b=ck2qLondVq4YWhVsb9yvBNcd0XMMOCM47n1tydQzxp4CRdrfod+3+jrI//JvgjaZ8X whXrlRfMMQ6bshLPzZLakAe45lbdEvSH76PtAeNFxXdZPxUuP5jMfJ8570SSy6JZOhyi 75P0Chrw70KB2eygCU/xQqzGAfPeXYPF1IZx/enozH5gO1oWVzhOL6zXzMXiQbIlKAao xkxdoOAHLZxA6R541LHafHm3uGRGVuhhOhB3N+phpCrFVGtbON6LJYkPnpy/ghs82QaL rlU3WxVKBuo6ZOxQMcj+H5ScPlv21A//YcMQ4L7haKujVrCAfQUmqB93hf5wVI1jTjKq /54A== X-Gm-Message-State: APjAAAVxLvFN0Ey5Ez4aA4VUnZm9bPS8Nvl+YKQ7Gj2PWTMLH9hkfM2z r/RN0cajIRvLzIpqUaAyRP06rt6fwIokvd3IgCCkPg== X-Received: by 2002:a17:90a:2488:: with SMTP id i8mr1641346pje.123.1562698320036; Tue, 09 Jul 2019 11:52:00 -0700 (PDT) MIME-Version: 1.0 References: <20190709183612.2693974-1-arnd@arndb.de> In-Reply-To: <20190709183612.2693974-1-arnd@arndb.de> From: Nick Desaulniers Date: Tue, 9 Jul 2019 11:51:48 -0700 Message-ID: Subject: Re: [PATCH] mm/kasan: fix kasan_check_read() compiler warning To: Arnd Bergmann Cc: Andrew Morton , Marco Elver , Mark Rutland , Andrey Ryabinin , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Kees Cook , Stephen Rothwell , Luc Van Oostenryck , Miguel Ojeda , Ingo Molnar , Josh Poimboeuf , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 9, 2019 at 11:36 AM Arnd Bergmann wrote: > > The kasan_check_read() is marked 'inline', which usually includes > the 'always_inline' attribute. In some configuration, gcc decides that > it cannot inline this, causing a build failure: > > In file included from include/linux/compiler.h:257, > from arch/x86/include/asm/current.h:5, > from include/linux/sched.h:12, > from include/linux/ratelimit.h:6, > from fs/dcache.c:18: > include/linux/compiler.h: In function 'read_word_at_a_time': > include/linux/kasan-checks.h:31:20: error: inlining failed in call to always_inline 'kasan_check_read': function attribute mismatch Sounds like the error `function attribute mismatch` is saying: kasan_check_read has one set of function attributes, but the call site read_word_at_a_time has different function attributes, so I wont inline kasan_check_read into read_word_at_a_time. __no_kasan_or_inline changes based on CONFIG_KASAN; was this from a kasan build or not? > static inline bool kasan_check_read(const volatile void *p, unsigned int size) > ^~~~~~~~~~~~~~~~ > In file included from arch/x86/include/asm/current.h:5, > from include/linux/sched.h:12, > from include/linux/ratelimit.h:6, > from fs/dcache.c:18: > include/linux/compiler.h:280:2: note: called from here > kasan_check_read(addr, 1); > ^~~~~~~~~~~~~~~~~~~~~~~~~ > > While I have no idea why it does this, but changing the call to the > internal __kasan_check_read() fixes the issue. > > Fixes: dc55b51f312c ("mm/kasan: introduce __kasan_check_{read,write}") > Signed-off-by: Arnd Bergmann > --- > include/linux/compiler.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > index f0fd5636fddb..22909500ba1d 100644 > --- a/include/linux/compiler.h > +++ b/include/linux/compiler.h > @@ -277,7 +277,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s > static __no_kasan_or_inline > unsigned long read_word_at_a_time(const void *addr) > { > - kasan_check_read(addr, 1); > + __kasan_check_read(addr, 1); > return *(unsigned long *)addr; > } > > -- > 2.20.0 > -- Thanks, ~Nick Desaulniers