Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1323086ybk; Thu, 21 May 2020 04:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+CvfjqKjjaieoo2/MSuEyIVT0NtkfCWCLmepq9/VnoLYJ5To7yehISYfvvp13dv8pWDz4 X-Received: by 2002:a50:fc0c:: with SMTP id i12mr7634807edr.174.1590059544687; Thu, 21 May 2020 04:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590059544; cv=none; d=google.com; s=arc-20160816; b=kkRxnulNGwBFkyxbowrOFCcjLy7xHA1Sel7vjzs4Adz6h4nUxF0NIia11N856a/Dv+ OHyme4uSQjlAhiDoVsVH3qLs2Sj8y2P3VpmW9UZzLKyX80wr7EhHayKuqPsAm3h971qr OfiNiEoejVj/yuO2ie/i+KWIDRUksYzB77hACHDQvAKN4lcWs6CwmgPlSxpongqPGC36 eitiMKO9aDSk2xmFnOF+UvxS7lF78MOWk6hHLe6ZCgBKPBv2014G96gno/VXLbrbFYOM gSpOgGRprhK9wcfWGVvI7gGhPJNv0qfrqbY9dQroF95FMXAYGNWNs3KNJAc40DGmhjfC kfSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=SvajioAcxE9ANa2I2vNqdu1VYDhOobctmex3U6Yh/nk=; b=s3Q17a0o8JTunapVO7o5nV40CFFmhmTr+PtTMTU3xLeGgOiJ00UFyFLkh0pqUaVS3g ZMuVjS3s8Qq/uBTMaEZi6JMQDuhmbyFgsMSrgS+nLAgvFGnr22wnnpXilhXP8ZNyZML5 2fAlQOVGcCTTt3NSj7XPPwLZZhOj+Z1UWe1vclVeiU5g1Vijsj1PMaxQlPOhc5rLeQ4Z 4cncvRX7XVY0oUHV4etuRieYCXK207g/o0RxSROLPEocz/TZC6WZFsljsHd6wvmgRGVa 8bUAbMsSRA6bf/NQ0a4qKcf9UAk/E0NPDxS9bYo/4BFUam0J3nOpdmUuaNJFWtuFYvS+ T+AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="mALz/ryu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y9si3034071ejc.567.2020.05.21.04.12.01; Thu, 21 May 2020 04:12:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="mALz/ryu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729158AbgEULKS (ORCPT + 99 others); Thu, 21 May 2020 07:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729130AbgEULKO (ORCPT ); Thu, 21 May 2020 07:10:14 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA245C061A0E for ; Thu, 21 May 2020 04:10:13 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id h129so4866090ybc.3 for ; Thu, 21 May 2020 04:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=SvajioAcxE9ANa2I2vNqdu1VYDhOobctmex3U6Yh/nk=; b=mALz/ryuWQvX4o5MErFi6iist6T1VROIzyxDcJ4LXQ/RplTvSAJj+TBbsCIkrQVcDi 3vtW6yE4ekL/VwJYiBih4wCfvVEb5Z5xEhF3NoFyqW8w6rsSKfVMdqxgEFa/6gHGhcO4 6tV20p5qt82DEqkExXWY9isgJithc/NWtKnxxypptE/jR057eglE10hz6GQgqB4CfbOi e3IcUo0cvdpFC+sHVnEOmyDPDC2XuLZ+VwlANvtt6JbKqCZSHbY+rAxe/rrMJT7tSCmX tWqeNFfghJwRcRWy8uzzVz1fknlm/POXY/lqfYcpg5aBBLsJI13pn9VVUG3zBkjsizZQ eaWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=SvajioAcxE9ANa2I2vNqdu1VYDhOobctmex3U6Yh/nk=; b=tR2hpreObeM9+FjA5lt2DQuKfOTOVIuOg2CIAZ6c3saL461MvrqoEQF0L4bGkpakWh 9f6i1wUaPR7s/L0GXa9XxbIZ4i6jlPGdIsEzZcug9INfMOFGR6/s+LPTEPXU50IKfVPt 0xYDFEa7+OjCg8GvwPgmZmi5OPN88qk2BZ+PyjuPmk+v5EUZnG6VtDdrbsEWovAN6Qf3 WEMrHsFZbr3dopjjwcBd/b4xyKXm2rqdpoYEJiTjagx3K6Z0iLMR4XWkOgrIfHUArvwn B6R7w95kfodc+0zbqlIQUF6OQnPXhRRj1GLRe083Mwb/1CWHL2Af7BBbOWw+/0GK55pq F6nw== X-Gm-Message-State: AOAM533Xb6N9zxKUjuDqBEY8qMLpB9ftW55LmU1topg2mLwsBnM9Mjd+ eYkBllaZqcCgA6IO5ZFAWSiz8KGVhw== X-Received: by 2002:a25:f20f:: with SMTP id i15mr14499554ybe.72.1590059413041; Thu, 21 May 2020 04:10:13 -0700 (PDT) Date: Thu, 21 May 2020 13:08:53 +0200 In-Reply-To: <20200521110854.114437-1-elver@google.com> Message-Id: <20200521110854.114437-11-elver@google.com> Mime-Version: 1.0 References: <20200521110854.114437-1-elver@google.com> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH -tip v2 10/11] compiler.h: Move function attributes to compiler_types.h From: Marco Elver To: elver@google.com Cc: paulmck@kernel.org, dvyukov@google.com, glider@google.com, andreyknvl@google.com, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, will@kernel.org, clang-built-linux@googlegroups.com, bp@alien8.de 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 Cleanup and move the KASAN and KCSAN related function attributes to compiler_types.h, where the rest of the same kind live. No functional change intended. Signed-off-by: Marco Elver --- include/linux/compiler.h | 29 ----------------------------- include/linux/compiler_types.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 1f9bd9f35368..8d3d03f9d562 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -249,35 +249,6 @@ do { \ __WRITE_ONCE(x, val); \ } while (0) -#ifdef CONFIG_KASAN -/* - * We can't declare function 'inline' because __no_sanitize_address conflicts - * with inlining. Attempt to inline it may cause a build failure. - * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 - * '__maybe_unused' allows us to avoid defined-but-not-used warnings. - */ -# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused -# define __no_sanitize_or_inline __no_kasan_or_inline -#else -# define __no_kasan_or_inline __always_inline -#endif - -#define __no_kcsan __no_sanitize_thread -#ifdef __SANITIZE_THREAD__ -/* - * Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in - * compilation units where instrumentation is disabled. - */ -# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused -# define __no_sanitize_or_inline __no_kcsan_or_inline -#else -# define __no_kcsan_or_inline __always_inline -#endif - -#ifndef __no_sanitize_or_inline -#define __no_sanitize_or_inline __always_inline -#endif - static __no_sanitize_or_inline unsigned long __read_once_word_nocheck(const void *addr) { diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 6ed0612bc143..b190a12e7089 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -167,6 +167,35 @@ struct ftrace_likely_data { */ #define noinline_for_stack noinline +#ifdef CONFIG_KASAN +/* + * We can't declare function 'inline' because __no_sanitize_address conflicts + * with inlining. Attempt to inline it may cause a build failure. + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 + * '__maybe_unused' allows us to avoid defined-but-not-used warnings. + */ +# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused +# define __no_sanitize_or_inline __no_kasan_or_inline +#else +# define __no_kasan_or_inline __always_inline +#endif + +#define __no_kcsan __no_sanitize_thread +#ifdef __SANITIZE_THREAD__ +/* + * Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in + * compilation units where instrumentation is disabled. + */ +# define __no_kcsan_or_inline __no_kcsan notrace __maybe_unused +# define __no_sanitize_or_inline __no_kcsan_or_inline +#else +# define __no_kcsan_or_inline __always_inline +#endif + +#ifndef __no_sanitize_or_inline +#define __no_sanitize_or_inline __always_inline +#endif + #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ -- 2.26.2.761.g0e0b3e54be-goog