Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1460020ybk; Thu, 21 May 2020 07:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLEgkJRb21nMQwq7zKfWb/Zx40z8EoFsHQzh3EicOCq8xn3BYY17blsLUoFUY2BGPLAvGi X-Received: by 2002:a17:906:c108:: with SMTP id do8mr4054313ejc.134.1590071091519; Thu, 21 May 2020 07:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590071091; cv=none; d=google.com; s=arc-20160816; b=Rkx7sIGhQ6p5dhzgqiHyySXxpM6rgaH91WmKINUhG5IZxPd/U3PeegS7k4NrVICCYz D3fYA+Fh7W1ZvNw+LpEw6i7V0Q+6xjMl24AnBRVWVB22hdW1tghUeTokMme2sJgl9y4y YSpo/sV/VYaoap5ZEj/Om6Tb1k9BaFyqhdcZUCIIyEio6BPblZL8+b463pRaduSCv6AZ RMO4hjtOVj0NS0V3YoWd0nJrbNLjSuwLekHyFAHoXaEXsmAAXe1ty+Jqx5BHmm9ORHf7 qkB9P5aiO4mAiQm+IOJ5bgLbKzV/cMF6XZEb+0n+y6OOgYPiSO+naVHINCvQEhqmin2z eAww== 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=Lmm+/+h5qLO6fUy4Is9S48RQHv+8MyPjNoPxJUCaU88=; b=gmtciSrGHmWNLdsprJvTz3whAVnKvYWX9kFDUGIEpQzkd8TtLYmREBq2QRQAGAIAcv zehRamORj+n34TdP/i15YI7BOHNqMhyweJ+BObIkEwDPKuOFuzotxS9y7Iu002AqInR4 L1HvGEylu2nPL43infqNAJPIEDVr+jLXw/LyemtyTqRwhjl6P4M2U8EI6hCKALu//T2W 2UNWKPwXwILWPzBzJ4zYoF/Kv4fxMuWeyhtcAlxfOe6MPMcnviZlNMwMUi41iLtXknDa IuEGw9PqdfRd4nHbgu2YHSb4P1xJ1yqnGcZT7QYPRqDvEuLH5Ys/sMlUxUaCP7RFsjtc r4Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ry3yF5S5; 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 k14si3357443ejz.419.2020.05.21.07.24.27; Thu, 21 May 2020 07:24:51 -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=Ry3yF5S5; 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 S1729686AbgEUOWs (ORCPT + 99 others); Thu, 21 May 2020 10:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729675AbgEUOWp (ORCPT ); Thu, 21 May 2020 10:22:45 -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 C541CC061A0E for ; Thu, 21 May 2020 07:22:43 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id k15so5501096ybt.4 for ; Thu, 21 May 2020 07:22:43 -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=Lmm+/+h5qLO6fUy4Is9S48RQHv+8MyPjNoPxJUCaU88=; b=Ry3yF5S5/LqKUOIQpGNAL925QQehVK9jMWjX8PjHCVoA0XPJgDubp7oFbY/CDc5ThC WT+0+uecdaVL9mF34dHUHm62BJaTSsum+nyk/7BRGtaSIo0CfuUst2nRWxDLmPQI89QI +EfLiybS+tHYvCsDoFRrWrqcBiBaOxZY8EJgGeUvWdYTvlvj3g2KPPhIeGWj4lC4HOj4 lS1EU36gsfoCEpfUFIUQa1ABmK44OnOuPq7qricwYQzsXdq73eqRwAVoEg4qfKY1Wszz qJvzYI+sBeM+aHoOD9Zfk+rBSEa3mXkekb06m6J8UASfj8D12i0ddnbMSjnmjhXb7rT3 4iOA== 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=Lmm+/+h5qLO6fUy4Is9S48RQHv+8MyPjNoPxJUCaU88=; b=T7X56ecJmf/62ukYyNN+V6jvZ6Ea6LDI3oE98A13lnqfRQu6iJK741dn2deOfa7cZ9 3jiD+7Zef3UZ3kNos+7DoYeGL+aqw37iypgOb+9X5djZLEmrPARm6a95miF4rbPfROnl dZtRQhNnp/1wVvvT16q94/2zx91WMxEOoQexdvlZrcPbKWv8bY1yi7WuhqPBCpFQhX1w ipIilopCOYZK1FdENFr6VHyV3cHrC/U/yZQ0g/48xMXQ1+7AXL4+U3y5p8yc0VTbq54Z NWyx3hECzZWzgZpXgU5OTQJI1wajTGuvk+Y+1nO5SAfTrDYjquiBslIAXjyaokhUtgsZ +t8A== X-Gm-Message-State: AOAM531GNBr9ASqxBPzKRXHaVEpANO10HD2i4tNLJ5tpHeg24+CtrTwP 0/6limN0BvqNbARTlL/2xLsfhq6bnw== X-Received: by 2002:a25:77d0:: with SMTP id s199mr14286095ybc.333.1590070963005; Thu, 21 May 2020 07:22:43 -0700 (PDT) Date: Thu, 21 May 2020 16:20:46 +0200 In-Reply-To: <20200521142047.169334-1-elver@google.com> Message-Id: <20200521142047.169334-11-elver@google.com> Mime-Version: 1.0 References: <20200521142047.169334-1-elver@google.com> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH -tip v3 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. Acked-by: Will Deacon 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 379a5077e9c6..652aee025c89 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -250,35 +250,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