Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp178505ybl; Wed, 11 Dec 2019 16:09:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwUs2xD4cvDaepIp2VG1jJN1KoKwEGvrZ9dU8d9mcts1HVbPwikcgnSOwNouR0S+xNF+CkB X-Received: by 2002:a9d:5550:: with SMTP id h16mr4465116oti.235.1576109355602; Wed, 11 Dec 2019 16:09:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576109355; cv=none; d=google.com; s=arc-20160816; b=HKVScZUN7Ujv/DzX/GU6RWLXmcBKW5CUUUOjvzQqJpGMMNNtbe29yoT5ql/HGMkVsi AYz3LwCVKG3q117izqlP2mXTGTrBar8BWvqHYdCOOG5Txxn3HYBFiXJb555+4AcBT9M4 5a4MegP3n3rTT+t13q/oEhJVcwx8MByZLjSRVSbVz/dpQ9/IungmtNN3pRgVpOoKbyyC ZFta98ZgLn+bD0+E210uCDs+U5X6R800baaYUcApdqE9aU5cVthI9g0bBMbZmsQMqYCq s7bosz2Ul4BfhmItGi14VgDgngRIhQSEahO3V+XtN3t6WJuJ2sAF3gfLDvM0yb+HaQcS unAw== 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=tqxzx3Ju5IffICSGxw8fWf7dGguiPyd/gZ03a4SjbqI=; b=a7OpR9dkiaGB0g8aWOHdcsgKpJMCYuDts0TIlCckabFroV3gny3P6dkebT/MtoG7AJ MYxVwtm2MmHZGCSP/ZKb4jade1QWR+UjU9vjCUR/dEUwpvF+Y6Y0Z8uYv0FCcpAlrYsm ++qL5v/X25F75jiz+5/aAGXsJqOH5iRrYW5h3qhwwNIxXNuL5Cfh7q/zb9XhVV3asEvq JVbou2oHaOW/n2fCPErImADG1zjcnIpZ7/AvTshqEnDilpni54vSgqzKeiMlgUpypwMU iN6+DHQlaDzpJj+jA1SuKFsACmP85YRoMy63b8DTnxGczsDzgY1c/JpLnAo4mwXxL9qs TVQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XfXWPnMa; 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 z11si2234536oic.119.2019.12.11.16.09.03; Wed, 11 Dec 2019 16:09:15 -0800 (PST) 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=XfXWPnMa; 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 S1727213AbfLLAHl (ORCPT + 99 others); Wed, 11 Dec 2019 19:07:41 -0500 Received: from mail-wr1-f73.google.com ([209.85.221.73]:39338 "EHLO mail-wr1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727183AbfLLAHk (ORCPT ); Wed, 11 Dec 2019 19:07:40 -0500 Received: by mail-wr1-f73.google.com with SMTP id 90so286152wrq.6 for ; Wed, 11 Dec 2019 16:07:39 -0800 (PST) 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=tqxzx3Ju5IffICSGxw8fWf7dGguiPyd/gZ03a4SjbqI=; b=XfXWPnMa5C9owrCf/+ji/xMeTE8wXtHYUTdluQHNxwxu1kNLVP4Usmfz1rO3gCpCqy 1Y4iw4ANp7BcDigb936glzSvlGiVWf2wSEXIAHjJhBhHpem9rHOxnxRLVqi5AQTe84Bl QLSFpqDTEUCY8tcQdMX2nS3zXP/ulwACZzb5dNDnXKg5yjL4ubnzTO7OK5Z8k+Bc2YJn U4ZdkD2Ji8v2Vc0nkpuh73BuHmjov3jpacvuA4T0a83v7iKy2WTJolZI0rYn1CBJ/ulq LTPHHiZnr5lyZ87WNs+jWae6FVjlxJTf3RS/aYTNgYzZuUUre/Y196fLP/RrVBNjIkoS +0sA== 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=tqxzx3Ju5IffICSGxw8fWf7dGguiPyd/gZ03a4SjbqI=; b=X1L93fvQGK4xg06GfnlzIh7LkfJd/fQRlEyhzJ63qhclp5t6mnAK1J06DnV+PgF+ts F25uTQoU84t4TL45Hr8+VqeuP3MIbDvScuNt050DSF+7w/ZAt8HNz3TGLWXRYgpwpTfC elBQ76KQIY+wM+gx19cEMlda84Suh3RpwDITVNKcscUJaCYDwfJsUl4BM4K6HqvES2v3 JRpfyDzwOtDOPCRDqG0Oyjnp4p72Rpd/J/Q/uDn8Lt8hpme2e0MeII8FVpoA3dJG7ovZ IfeAdLwv71h+K+N2zQvvMRD5sQCLHppylJ8pUqj8RoqkAFmNghogMZE/HWHKKIRR4aHN H9KA== X-Gm-Message-State: APjAAAWFYKHmceGuXhIvW5gzx8Hdk3uqxAR5EjOeaULSZI6LuuJ5gxoH 5DGJwlQLrUWt9ie6tTK58GYE7m7Btg== X-Received: by 2002:adf:ffc7:: with SMTP id x7mr2678183wrs.159.1576109257933; Wed, 11 Dec 2019 16:07:37 -0800 (PST) Date: Thu, 12 Dec 2019 01:07:09 +0100 In-Reply-To: <20191212000709.166889-1-elver@google.com> Message-Id: <20191212000709.166889-2-elver@google.com> Mime-Version: 1.0 References: <20191212000709.166889-1-elver@google.com> X-Mailer: git-send-email 2.24.0.525.g8f36a354ae-goog Subject: [PATCH -rcu/kcsan 2/2] kcsan: Add __no_kcsan function attribute From: Marco Elver To: elver@google.com Cc: torvalds@linux-foundation.org, paulmck@kernel.org, mingo@kernel.org, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, stern@rowland.harvard.edu, dvyukov@google.com, mark.rutland@arm.com, parri.andrea@gmail.com, edumazet@google.com, linux-doc@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org 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 Since the use of -fsanitize=thread is an implementation detail of KCSAN, the name __no_sanitize_thread could be misleading if used widely. Instead, we introduce the __no_kcsan attribute which is shorter and more accurate in the context of KCSAN. This matches the attribute name __no_kcsan_or_inline. The use of __kcsan_or_inline itself is still required for __always_inline functions to retain compatibility with older compilers. Signed-off-by: Marco Elver --- include/linux/compiler-gcc.h | 3 +-- include/linux/compiler.h | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0eb2a1cc411d..cf294faec2f8 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -146,8 +146,7 @@ #endif #if defined(__SANITIZE_THREAD__) && __has_attribute(__no_sanitize_thread__) -#define __no_sanitize_thread \ - __attribute__((__noinline__)) __attribute__((no_sanitize_thread)) +#define __no_sanitize_thread __attribute__((no_sanitize_thread)) #else #define __no_sanitize_thread #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7d3e77781578..a35d5493eeaa 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -207,12 +207,15 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, # 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. + * compilation units where instrumentation is disabled. The attribute 'noinline' + * is required for older compilers, where implicit inlining of very small + * functions renders __no_sanitize_thread ineffective. */ -# define __no_kcsan_or_inline __no_sanitize_thread notrace __maybe_unused +# define __no_kcsan_or_inline __no_kcsan noinline notrace __maybe_unused # define __no_sanitize_or_inline __no_kcsan_or_inline #else # define __no_kcsan_or_inline __always_inline -- 2.24.0.525.g8f36a354ae-goog