Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp572544ybk; Fri, 15 May 2020 08:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+g1SS+drrDXA3E4R5elMx+BhzV7ThARh6eNftwfj+fz3+I7Vax7MSKxm/iLsYJNvf+4U8 X-Received: by 2002:a17:907:1106:: with SMTP id qu6mr3327254ejb.321.1589555165759; Fri, 15 May 2020 08:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589555165; cv=none; d=google.com; s=arc-20160816; b=ybQVNcwH/ut0WiGTNclWuckbT6QknM2PK29jH/fXnZxPARItzOFHPw7G8TPLnfL2x4 ktsWwHJSsmwL3mjdCgbSnlWDL684TeaPX7woCO7OVkUeLB8fo78hrumnyD27jpC7V6fv h/vJ72NPDgGlUVhE0cate67FlTJh905Lq5LEbF2kblsqJSXlGauX28hU/3kZ30AiaqNc uhwLyCBOzsZ9VAoDdGUguaU+tTHiYKcdpxWBk/N6YElcnLfRsl4P5dsXU9RoMXNXVtQx d3FXWyYkWRoquHef7zA87boYRaHv9/yiuPtMODnaBUFk8bi9gnclLNPBTt2k7OdkLNdE B1MQ== 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=O66Rrrp+JcFi/5yju5R8rYLztnbdicYxc/HcFiSiC0Y=; b=VjLLZui5HfBOmVkwxQsF+JGlByvdC5jkfY9aGpDy2mvVXSfYC0fZLdLJzghGALSTr+ vsdv/mJc98o0KelNonuhYMl/Ob6hIJPq9ie0wetugv7GfQO1BRNcTP4gres6K2EXV5fr 6JmFIEqdHr5wtJF7bSVS2n+ORq3aPPylIkgGBKQrTBJVHMhXuIHdV1joNFju3CLCH/pk R+kf80CO+1W4fi6rwtACDG171I5M7t9463hZjTe52c6nKpTF5zhfbjaXwX5Tv34a8LXI ovWwO4gv2X83teU8wzxJfgyIybHBvzwTZDbGzkT4I8QkjKdbB/6zhq+gYzenW/m257mj fYVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SZSlqP2Z; 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 p12si1416863ejo.249.2020.05.15.08.05.42; Fri, 15 May 2020 08:06:05 -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=SZSlqP2Z; 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 S1726855AbgEOPEB (ORCPT + 99 others); Fri, 15 May 2020 11:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726731AbgEOPD6 (ORCPT ); Fri, 15 May 2020 11:03:58 -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 7325AC061A0C for ; Fri, 15 May 2020 08:03:58 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id n77so2898390ybf.2 for ; Fri, 15 May 2020 08:03:58 -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=O66Rrrp+JcFi/5yju5R8rYLztnbdicYxc/HcFiSiC0Y=; b=SZSlqP2Zz7/IiH8vmfOLGm5Fr76hdqLoKSncO/ssRbjpDAhkmmA4O3HDISAIzYtp3+ 1mXXJ4xypoEbEJZ0Gp1czn88brlNSGbeodFpxtkck89ea0D5qOuEEI8V/3I8Ec7NzWzq 2sB/qmKB7ocNAhwXBhclm/WqLaZ+W7W+ZzGG2hfk1754P6NYqAECkNEiVBmdZyCft0NI Q63rAZaer6HJdfHEtiWVNdT/tCxs4Cimzj3ppbtuYmVG8PoO5ADYym003WBXX9NmXziu kcXPIsoBaNUfrRHE6bFNYoa604YWpJKMzGCq+qaZlh98aRInFIn8inwLmCnN2hboLqys FHsg== 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=O66Rrrp+JcFi/5yju5R8rYLztnbdicYxc/HcFiSiC0Y=; b=JETyOgO551aa7RVLXuuSOFsEmO1EQ9576KdadPoUo5d6XcrOGJj9obX8pS9Xi9I1kA WYKTjljMIRYFswsclOJI90ulGVTORbMWyP3gn637TFZeIsmnerny7y2aXyi5+DaNDRdo f6JGLFJoS9gAm/LshwK0wvhLg+K1uWxGX/pR1PmQOo1e6H6ss5T/nRQ0A2NPB45JXmGG in9k8w+8GrvGQpFON3/98+mwH/f+ktPoKiGFCAQd8iMD12Jgjn/4hdz79b7rlT3k3c1v bx66t2/XsBmhAloD9jfFEr/TzXCEx4DM57s/WzGIfbt/TB2EOB+LlDFhvsTCuH7h5MHE lbXw== X-Gm-Message-State: AOAM531aYYoKhFsNtsdYUl57plWxoqi2+yCyjVPVijEh0TH3yBVnUOQ2 1GyS5Q3ibAOv6ge1V0J9DPw6ZfnoHQ== X-Received: by 2002:a25:874b:: with SMTP id e11mr6243676ybn.23.1589555037606; Fri, 15 May 2020 08:03:57 -0700 (PDT) Date: Fri, 15 May 2020 17:03:33 +0200 In-Reply-To: <20200515150338.190344-1-elver@google.com> Message-Id: <20200515150338.190344-6-elver@google.com> Mime-Version: 1.0 References: <20200515150338.190344-1-elver@google.com> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH -tip 05/10] kcsan: Remove 'noinline' from __no_kcsan_or_inline 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 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 Some compilers incorrectly inline small __no_kcsan functions, which then results in instrumenting the accesses. For this reason, the 'noinline' attribute was added to __no_kcsan_or_inline. All known versions of GCC are affected by this. Supported version of Clang are unaffected, and never inlines a no_sanitize function. However, the attribute 'noinline' in __no_kcsan_or_inline causes unexpected code generation in functions that are __no_kcsan and call a __no_kcsan_or_inline function. In certain situations it is expected that the __no_kcsan_or_inline function is actually inlined by the __no_kcsan function, and *no* calls are emitted. By removing the 'noinline' attribute we give the compiler the ability to inline and generate the expected code in __no_kcsan functions. Link: https://lkml.kernel.org/r/CANpmjNNOpJk0tprXKB_deiNAv_UmmORf1-2uajLhnLWQQ1hvoA@mail.gmail.com Signed-off-by: Marco Elver --- include/linux/compiler.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index e24cc3a2bc3e..17c98b215572 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -276,11 +276,9 @@ do { \ #ifdef __SANITIZE_THREAD__ /* * Rely on __SANITIZE_THREAD__ instead of CONFIG_KCSAN, to avoid not inlining in - * 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. + * compilation units where instrumentation is disabled. */ -# define __no_kcsan_or_inline __no_kcsan noinline notrace __maybe_unused +# 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 -- 2.26.2.761.g0e0b3e54be-goog