Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp637578ybc; Tue, 19 Nov 2019 06:57:56 -0800 (PST) X-Google-Smtp-Source: APXvYqw1eEwynwblYaWu+cVejK2HDJ2E7aovVeBAA2U8K3eBkDt/ZIUIMGQfM74qN2Oz3tmD/bAc X-Received: by 2002:a5d:448f:: with SMTP id j15mr12592595wrq.70.1574175476109; Tue, 19 Nov 2019 06:57:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574175476; cv=none; d=google.com; s=arc-20160816; b=aDIilwEHeUv3evdOqJowTf8GtcK6QVgoWBYlD2F2aYEKCWXKTVuy2lDQUBlQN08tM6 17A+fTSKs82pPutwivLSuMcW691cJ9407zfzUgsXT2nI4K4m4GlcmKmKX7abYsYZ4+iK FtN4ZAgIk3Od/JNyfgJoLQ8SKW149TX/XpvvK2hEMzzQL+aLVSmaJKwiIE0jg/1c5xHY R1oeSKWbJV3eKEMa+tDzqNOmrbNq/6Dwjpt4N1l5aIBcdroyoQ1SEhOhTodAfKpap8Ze CoLv8wnekj2IICWLqEtMht4A8lGzZKfjYI6Zy2SX3RK7Y1GGiX2LN74qNmJ4aGdrG1BF WlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7TaNjYSFllAioeamxFmbzjoei4GnJqZJAcca8Hrbd3Y=; b=XWRLHxVyrJ8kPN+brw69q+uZoPhxHEIvidGDrv14udeZKitfkxFhwzDiECVEoC6F+J sJISa3Dx2W88lE4+jCkkLy8t6/o5dRA5k43uWZzzqITXCW0FG9FVisZeu0Mc1aoOoMD5 qXySL2JI4aLM1ROKkc0x+3yWHocQO7h85Pcg/U/OrlkKDaYcLNvo20wrQodUUsvBvUVZ JB/C6FB4sLjOwb0eEqWXYle1phEBCINOYAzi95KqCmVI7ziV8AvOtxjCyWY+hLMD1FGl Ll4Md/fw0vdQ/SIDQNIt4MY35o68nHEfoGssSZgzns/i1fT9RdFbg0HgPuQRRq5MwSrY 65EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nNqxkTun; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c57si16047720edc.386.2019.11.19.06.57.32; Tue, 19 Nov 2019 06:57:56 -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=@kernel.org header.s=default header.b=nNqxkTun; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbfKSO4U (ORCPT + 99 others); Tue, 19 Nov 2019 09:56:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:34826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfKSO4U (ORCPT ); Tue, 19 Nov 2019 09:56:20 -0500 Received: from paulmck-ThinkPad-P72.home (199-192-87-166.static.wiline.com [199.192.87.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 99FE4222A0; Tue, 19 Nov 2019 14:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574175378; bh=0Ljh4HfAXA7BAQs+eBmjHbb2K6a07lLbR0S63uNYi50=; h=Date:From:To:Cc:Subject:Reply-To:From; b=nNqxkTunp73XruGKE4BEcS7t7f6t+aACKFK0b4f/xmPtLAjAOm9A32awUXo+QJQSC HTjtS3b0F3pJ+zSH2TzJ0IlwHh0xJlWlsjYYTwnYdL2lLPCJ7Ls2rLaPXWvunrA0Ss Ff7RPCVIGvgLDHLxtIwAMfnXiaIEj+Z8s7/79d4M= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 4267D3520F2F; Tue, 19 Nov 2019 06:56:18 -0800 (PST) Date: Tue, 19 Nov 2019 06:56:18 -0800 From: "Paul E. McKenney" To: mingo@kernel.org Cc: elver@google.com, linux-kernel@vger.kernel.org, sfr@canb.auug.org.au Subject: [GIT RFC PULL kcsan] KCSAN commits for 5.5 Message-ID: <20191119145618.GA19028@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Ingo, This pull request contains base kernel concurrency sanitizer (KCSAN) enablement for x86, courtesy of Marco Elver. KCSAN is a sampling watchpoint-based data-race detector, and is documented in Documentation/dev-tools/kcsan.rst. KCSAN was announced in September, and much feedback has since been incorporated: http://lkml.kernel.org/r/CANpmjNPJ_bHjfLZCAPV23AXFfiPiyXXqqu72n6TgWzb2Gnu1eA@mail.gmail.com The data races located thus far have resulted in a number of fixes: https://github.com/google/ktsan/wiki/KCSAN#upstream-fixes-of-data-races-found-by-kcsan Additional information may be found here: https://lore.kernel.org/lkml/20191114180303.66955-1-elver@google.com/ This has been subject to kbuild test robot and -next testing. The -next testing located a Kconfig conflict called out here: https://lore.kernel.org/lkml/20191119183042.5839ef00@canb.auug.org.au/ Marco is satisfied with Stephen's resolution, and it looks good to me as well. The following changes since commit 31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c: Linux 5.4-rc7 (2019-11-10 16:17:15 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git for-mingo for you to fetch changes up to 40d04110f87940b6a03bf0aa19cd29e84f465f20: x86, kcsan: Enable KCSAN for x86 (2019-11-16 07:23:16 -0800) ---------------------------------------------------------------- Marco Elver (9): kcsan: Add Kernel Concurrency Sanitizer infrastructure include/linux/compiler.h: Introduce data_race(expr) macro kcsan: Add Documentation entry in dev-tools objtool, kcsan: Add KCSAN runtime functions to whitelist build, kcsan: Add KCSAN build exceptions seqlock, kcsan: Add annotations for KCSAN seqlock: Require WRITE_ONCE surrounding raw_seqcount_barrier locking/atomics, kcsan: Add KCSAN instrumentation x86, kcsan: Enable KCSAN for x86 Documentation/dev-tools/index.rst | 1 + Documentation/dev-tools/kcsan.rst | 256 ++++++++++++ MAINTAINERS | 11 + Makefile | 3 +- arch/x86/Kconfig | 1 + arch/x86/boot/Makefile | 2 + arch/x86/boot/compressed/Makefile | 2 + arch/x86/entry/vdso/Makefile | 3 + arch/x86/include/asm/bitops.h | 6 +- arch/x86/kernel/Makefile | 4 + arch/x86/kernel/cpu/Makefile | 3 + arch/x86/lib/Makefile | 4 + arch/x86/mm/Makefile | 4 + arch/x86/purgatory/Makefile | 2 + arch/x86/realmode/Makefile | 3 + arch/x86/realmode/rm/Makefile | 3 + drivers/firmware/efi/libstub/Makefile | 2 + include/asm-generic/atomic-instrumented.h | 393 ++++++++++--------- include/linux/compiler-clang.h | 9 + include/linux/compiler-gcc.h | 7 + include/linux/compiler.h | 57 ++- include/linux/kcsan-checks.h | 97 +++++ include/linux/kcsan.h | 115 ++++++ include/linux/sched.h | 4 + include/linux/seqlock.h | 51 ++- init/init_task.c | 8 + init/main.c | 2 + kernel/Makefile | 6 + kernel/kcsan/Makefile | 11 + kernel/kcsan/atomic.h | 27 ++ kernel/kcsan/core.c | 626 ++++++++++++++++++++++++++++++ kernel/kcsan/debugfs.c | 275 +++++++++++++ kernel/kcsan/encoding.h | 94 +++++ kernel/kcsan/kcsan.h | 108 ++++++ kernel/kcsan/report.c | 320 +++++++++++++++ kernel/kcsan/test.c | 121 ++++++ kernel/sched/Makefile | 6 + lib/Kconfig.debug | 2 + lib/Kconfig.kcsan | 118 ++++++ lib/Makefile | 3 + mm/Makefile | 8 + scripts/Makefile.kcsan | 6 + scripts/Makefile.lib | 10 + scripts/atomic/gen-atomic-instrumented.sh | 17 +- tools/objtool/check.c | 18 + 45 files changed, 2623 insertions(+), 206 deletions(-) create mode 100644 Documentation/dev-tools/kcsan.rst create mode 100644 include/linux/kcsan-checks.h create mode 100644 include/linux/kcsan.h create mode 100644 kernel/kcsan/Makefile create mode 100644 kernel/kcsan/atomic.h create mode 100644 kernel/kcsan/core.c create mode 100644 kernel/kcsan/debugfs.c create mode 100644 kernel/kcsan/encoding.h create mode 100644 kernel/kcsan/kcsan.h create mode 100644 kernel/kcsan/report.c create mode 100644 kernel/kcsan/test.c create mode 100644 lib/Kconfig.kcsan create mode 100644 scripts/Makefile.kcsan