Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1459600ybk; Thu, 21 May 2020 07:24:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPb99t2+vsBkZ1LtCEgwiW7nJNgILBxSd1y+YKXfYU9mzEQFaKoF74duXMX3dJ/hUser+L X-Received: by 2002:a05:6402:206f:: with SMTP id bd15mr8336189edb.3.1590071052004; Thu, 21 May 2020 07:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590071051; cv=none; d=google.com; s=arc-20160816; b=AOiWrdzVNRa5SEBzlATUqMvrn7yc2E2djj3AwFTGBKkL4TFv+IMGT4YQko+hTwhjFf lQk52KCoGZ1jlk37CZt/j4xxh0RZJbyiRodoZ+UVFE+WwZ5FL1CvKCwVHZxtXpwVM0B+ 5U5T4BmKWGV6IcKONCF/iRzus6Pm9anYPnX7MYRyicuZF2KgFjwRnjiIUFtxpMH6w1kf yY3WUKg3MgSMm6uMmbGPniSuosvILebj+VYiTbnHSXk5HZc0DgkyvX/Y4r1UOG2iRybH AYNLOYW3+H6KntpqQltwZbQUHXTdDN/53U8IThzymMw3piNHDfIKdaLuBEwR8aSgFXpE wv8Q== 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:mime-version :message-id:date:dkim-signature; bh=oGh0kqYNNAZM+Pjnllixvw53KGUxiJ/hODIqL9XqSI8=; b=AXT1cJvpY8WU5MFDoIav0nxOztACQR/jgpm6LmL/OgpWB5pc0rXRWWMIZmpOVXtIeR sNCaB9/zElbbz9r5fx3puL/96nkcUQ4kV6akHnfEvLQPiZl/gEuUuUshgxdW3h7QO97L RDwvlOsD9pL4ZBiH17o7uzkaK3PM1icGYSeeKfEELPq4al47sqm7G2sp3mXeD7QMYib8 qZ4aYkpfdg2ODxqhZVfHBcsCgn+3l4IM56VuqnSP//iwiZKsW2OaYK+IGuc7kihrETyG zEzODYYWs03yHgwuoKyh/XmoJSE2OAuwn5bhpaJU48gWZbpswOzrT++WHaJD+1HBTVry KrFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=N53ce3W4; 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 ly12si3292608ejb.623.2020.05.21.07.23.48; Thu, 21 May 2020 07:24:11 -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=N53ce3W4; 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 S1728198AbgEUOWW (ORCPT + 99 others); Thu, 21 May 2020 10:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726965AbgEUOWW (ORCPT ); Thu, 21 May 2020 10:22:22 -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 1A323C061A0E for ; Thu, 21 May 2020 07:22:21 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id s8so5409529ybj.9 for ; Thu, 21 May 2020 07:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=oGh0kqYNNAZM+Pjnllixvw53KGUxiJ/hODIqL9XqSI8=; b=N53ce3W4F1IpXl4ChkhdD3LWxnFiRQVJTDL/wOUQii97P48NWSVAOdhXhgVaK48dk2 Nt+pmmEb6P2ovsbhfKsEFFJSCEh04b4IQXvk5tWHWPZB0OwsKf9HGGkpT9xSP+2cE+Jw feBQA60lAHIvLnpOGDdkBImyHOP2cSc8S44i3uHeB7sydq7ipF07dXaD07zKMLwfaHB0 7UuBbFsW5XcbfHbbdvwMg36zr8EGAu1uAJCzt4XR1ghuFjJ1MU9KRNUzD0y2mPkd12zn 6LSIa0TMbDakv/vL8ba+Kzlfali/1fW2BgEIqAUE59I9Fk9i+6XG8BPCy0dWyRthf+rR B46g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=oGh0kqYNNAZM+Pjnllixvw53KGUxiJ/hODIqL9XqSI8=; b=bcYVt2gAOOcPRLd35ZpuBqWRStySLG8oDOvpvwoyVRxoV55a4tnDduDxW2Sk6WQtC8 qTRkX1DhWodJ6dhoH0H+bC8RUgamY7ZlZTWcima7ZEUiGDdwksNWjz/gTXnr9xXpFi+d Fd6+1Pf51yh5faKZdamVwTPl/4sTSWeL0bQCCdalY2p0OsmwiHlgl3B0+GsONJ1Yh2dI NnS3w9lvMufW2WGGUq1GVbgivP0Z1SrO2t1hn8/7u8mQREzJlAvtuPOgLWDe9xZ5/qH1 vLI4U5/Je62yu0bq84JrSjgg1sGNvixk2mhVMDpiGIRKFRqC6DDzy6DPUqnFIZfwCZup 5QaQ== X-Gm-Message-State: AOAM531fWbGALVNsOaf2vwN4pw8UHRmdVr+keHbu4hcZCUycvkYkude/ nYfIwBLTaebpDuEEPWS9gH8DOWATJw== X-Received: by 2002:a25:e86:: with SMTP id 128mr16977291ybo.344.1590070940186; Thu, 21 May 2020 07:22:20 -0700 (PDT) Date: Thu, 21 May 2020 16:20:36 +0200 Message-Id: <20200521142047.169334-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog Subject: [PATCH -tip v3 00/11] Fix KCSAN for new ONCE (require Clang 11) 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 This patch series is the conclusion to [1], where we determined that due to various interactions with no_sanitize attributes and the new {READ,WRITE}_ONCE(), KCSAN will require Clang 11 or later. Other sanitizers are largely untouched, and only KCSAN now has a hard dependency on Clang 11. To test, a recent Clang development version will suffice [2]. While a little inconvenient for now, it is hoped that in future we may be able to fix GCC and re-enable GCC support. The patch "kcsan: Restrict supported compilers" contains a detailed list of requirements that led to this decision. Most of the patches are related to KCSAN, however, the first patch also includes an UBSAN related fix and is a dependency for the remaining ones. The last 2 patches clean up the attributes by moving them to the right place, and fix KASAN's way of defining __no_kasan_or_inline, making it consistent with KCSAN. The series has been tested by running kcsan-test several times and completed successfully. [1] https://lkml.kernel.org/r/CANpmjNOGFqhtDa9wWpXs2kztQsSozbwsuMO5BqqW0c0g0zGfSA@mail.gmail.com [2] https://github.com/llvm/llvm-project v3: * data_race() fix for 'const' non-scalar expressions. * Add a missing commit message. * Add Will's Acked-by. v2: https://lkml.kernel.org/r/20200521110854.114437-1-elver@google.com * Remove unnecessary kcsan_check_atomic in ONCE. * Simplify __READ_ONCE_SCALAR and remove __WRITE_ONCE_SCALAR. This effectively restores Will Deacon's pre-KCSAN version: https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/tree/include/linux/compiler.h?h=rwonce/cleanup#n202 * Introduce patch making data_race() a single statement expression in response to apparent issues that compilers are having with nested statement expressions. Arnd Bergmann (1): ubsan, kcsan: don't combine sanitizer with kcov on clang Marco Elver (10): kcsan: Avoid inserting __tsan_func_entry/exit if possible kcsan: Support distinguishing volatile accesses kcsan: Pass option tsan-instrument-read-before-write to Clang kcsan: Remove 'noinline' from __no_kcsan_or_inline kcsan: Restrict supported compilers kcsan: Update Documentation to change supported compilers READ_ONCE, WRITE_ONCE: Remove data_race() and unnecessary checks data_race: Avoid nested statement expression compiler.h: Move function attributes to compiler_types.h compiler_types.h, kasan: Use __SANITIZE_ADDRESS__ instead of CONFIG_KASAN to decide inlining Documentation/dev-tools/kcsan.rst | 9 +----- include/linux/compiler.h | 54 ++++--------------------------- include/linux/compiler_types.h | 32 ++++++++++++++++++ kernel/kcsan/core.c | 43 ++++++++++++++++++++++++ lib/Kconfig.kcsan | 20 +++++++++++- lib/Kconfig.ubsan | 11 +++++++ scripts/Makefile.kcsan | 15 ++++++++- 7 files changed, 127 insertions(+), 57 deletions(-) -- 2.26.2.761.g0e0b3e54be-goog