Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp822390ybt; Wed, 24 Jun 2020 12:04:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnhm7tJuuYmo6w4w5iS2RxfalqmWjIZD4eDyKgV/Z4176loeoNzvtbU8XWfcryUEW9Ew0q X-Received: by 2002:a17:906:6686:: with SMTP id z6mr25511856ejo.258.1593025467348; Wed, 24 Jun 2020 12:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593025467; cv=none; d=google.com; s=arc-20160816; b=jg6c2vfQMNFNIh8AxbIbyct7SAAk+ea6HC/0R8m/oVJGGeaypVFIMRbBRlGH/JEgrO 9FY2ZBNrdKhzNHSTxtkRMc0NMbslWobSD9wdPRyUiWWEy9kZ8vW9L0sS1hpVX9YAHEML wvhgWcanv6Zu8xeZkYPznyAHkrrW+uQdjj/sgo5Vr6vJ43ppj0tqy2BHTnNGX5goruP/ qibLfQhtFK49YHG9qA36E9ZLJIjNc60gmQOmOilT9druHo19uutA/qWjnqPdV5sW4wDh V2K/feqpGlzf7ojNENEkQXFq90X+guDeeUA3ju9wVcvX2j3KI3hEekpQjtoXYNC63ALy K8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=hFNrBRvKDlDUQ1+WIffPoMxbZK0XMKvmDDxPMtZURq4=; b=Qak77It71OYeLVbZ4U1oASuLe6Tv17kmIPVk2WbF769msRsuUbEqaFxZ9Y05yrOaAv JptsGM9Gro2OhFlbALKXm3KNblAd4ojUm/76D6HsSZLq9L2Amsegwa0lIePBVtYB86Xj TmZKWTdXhgHijS/FBxieC10Hxp+H63Ez/iuy1CaHqSCTvhbJ13fQFK8n+HtnYG9dM/i0 luC77KQ3lmQDQ8ssASMkLFch2++OLhmDau/t26Q7qHHAf9+pMvEowln6NB5ZhVGXUdEL 72Ol+irB3Pc/f6h99xMwhZ5yqt8FgDgYzRoJRs1cXneteB+Gd6H7k19PXyHB8/1s8LSF U5CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cy5H4ScO; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y66si14317977ede.453.2020.06.24.12.04.02; Wed, 24 Jun 2020 12:04:27 -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=@kernel.org header.s=default header.b=Cy5H4ScO; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404965AbgFXTDL (ORCPT + 99 others); Wed, 24 Jun 2020 15:03:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:55522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404055AbgFXTDK (ORCPT ); Wed, 24 Jun 2020 15:03:10 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A26FD2082F; Wed, 24 Jun 2020 19:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593025389; bh=ei0Jqp3I9nhWh4bhWBsvoOAw69GmcA9g2P0YkI+LMEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cy5H4ScOUCe6zZNFIoGkJo3zzQUEtVgOEAT7hy3fU4BMEyi5Sle9Vh+wATDEB31Je e1OraH8+meqx91PTNrEECCsxrYW0Kdpl7YIngrcR0PyNb9sn7+dg3qz050frM9Clkm F5htZIXUUB3r7OgJxvea4AosuDG/ChALOhgyyHxI= From: paulmck@kernel.org To: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, kernel-team@fb.com, mingo@kernel.org Cc: elver@google.com, andreyknvl@google.com, glider@google.com, dvyukov@google.com, cai@lca.pw, boqun.feng@gmail.com, Martin Liska , "Paul E . McKenney" Subject: [PATCH kcsan 1/3] kcsan: Re-add GCC as a supported compiler Date: Wed, 24 Jun 2020 12:03:05 -0700 Message-Id: <20200624190307.15191-1-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200624190236.GA6603@paulmck-ThinkPad-P72> References: <20200624190236.GA6603@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marco Elver GCC version 11 recently implemented all requirements to correctly support KCSAN: 1. Correct no_sanitize-attribute inlining behaviour: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4089df8ef4a63126b0774c39b6638845244c20d2 2. --param=tsan-distinguish-volatile https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ab2789ec507a94f1a75a6534bca51c7b39037ce0 3. --param=tsan-instrument-func-entry-exit https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=06712fc68dc9843d9af7c7ac10047f49d305ad76 Therefore, we can re-enable GCC for KCSAN, and document the new compiler requirements. Signed-off-by: Marco Elver Cc: Martin Liska Signed-off-by: Paul E. McKenney --- Documentation/dev-tools/kcsan.rst | 3 ++- lib/Kconfig.kcsan | 3 ++- scripts/Makefile.kcsan | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Documentation/dev-tools/kcsan.rst b/Documentation/dev-tools/kcsan.rst index ce4bbd9..8fa0dd6 100644 --- a/Documentation/dev-tools/kcsan.rst +++ b/Documentation/dev-tools/kcsan.rst @@ -8,7 +8,8 @@ approach to detect races. KCSAN's primary purpose is to detect `data races`_. Usage ----- -KCSAN requires Clang version 11 or later. +KCSAN is supported by both GCC and Clang. With GCC we require version 11 or +later, and with Clang also require version 11 or later. To enable KCSAN configure the kernel with:: diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan index 3f3b5bc..3d282d5 100644 --- a/lib/Kconfig.kcsan +++ b/lib/Kconfig.kcsan @@ -4,7 +4,8 @@ config HAVE_ARCH_KCSAN bool config HAVE_KCSAN_COMPILER - def_bool CC_IS_CLANG && $(cc-option,-fsanitize=thread -mllvm -tsan-distinguish-volatile=1) + def_bool (CC_IS_CLANG && $(cc-option,-fsanitize=thread -mllvm -tsan-distinguish-volatile=1)) || \ + (CC_IS_GCC && $(cc-option,-fsanitize=thread --param tsan-distinguish-volatile=1)) help For the list of compilers that support KCSAN, please see . diff --git a/scripts/Makefile.kcsan b/scripts/Makefile.kcsan index bd4da1a..dd66206 100644 --- a/scripts/Makefile.kcsan +++ b/scripts/Makefile.kcsan @@ -6,7 +6,7 @@ ifdef CONFIG_KCSAN ifdef CONFIG_CC_IS_CLANG cc-param = -mllvm -$(1) else -cc-param = --param -$(1) +cc-param = --param $(1) endif # Keep most options here optional, to allow enabling more compilers if absence -- 2.9.5