From patchwork Wed Mar 25 16:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11458289 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D671E6CA for ; Wed, 25 Mar 2020 16:14:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A67B20409 for ; Wed, 25 Mar 2020 16:14:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g5mHdfJr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A67B20409 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1B0336B00A4; Wed, 25 Mar 2020 12:14:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 114AA6B00A6; Wed, 25 Mar 2020 12:14:30 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF7C26B00A7; Wed, 25 Mar 2020 12:14:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id CFC046B00A4 for ; Wed, 25 Mar 2020 12:14:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AC72A8248047 for ; Wed, 25 Mar 2020 16:14:29 +0000 (UTC) X-FDA: 76634382258.11.place50_7e7f843e8c637 X-Spam-Summary: 2,0,0,fb1086efd5be15f2,d41d8cd98f00b204,3y4n7xgykcfi052xyb08805y.w86527eh-664fuw4.8b0@flex--glider.bounces.google.com,,RULES_HIT:41:152:355:379:541:617:800:960:973:982:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2897:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3872:4117:4250:4321:4605:5007:6261:6653:6742:6743:7875:7903:8660:9969:10004:10400:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:13148:13230:13846:14093:14097:14181:14394:14659:14721:21080:21365:21444:21451:21611:21627:30054:30064,0,RBL:209.85.221.73:@flex--glider.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: place50_7e7f843e8c637 X-Filterd-Recvd-Size: 6400 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Mar 2020 16:14:29 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id f8so1379649wrp.1 for ; Wed, 25 Mar 2020 09:14:29 -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=bBG9lgwUrPmgqsOzzaW4vKvaQj094UYKenoIEuCe488=; b=g5mHdfJr1Grg2tNVALATfglEcximeLr1JkhMXGCrX1jrxFvYMFD0BRR4BBFu71TviS uwjAyYjGra03P9Ch+DgtAGn/+BkqQlV7/hSBCgAoBZasZHb6KCZVdbIzWp7148yTwuPD ufuiF4IMBql1B9cfESx80zq567Lzq22nw7axYsZlfwJ0U1GeAuwIWpRM/m9JRAL4/Fku xyufYUDsV2J6ouLMPen5UZj1VV/Sqvecx5Tzj0CNGmCdT0r6Xj/4qkPBSGdVH4zqXEmQ R3W6a7qdFUQgbsLmlH40MHQVRSoD3ZsoC4XJM+WiUmP850BVLJ+AskWgMJh54uTKFhf9 AU+g== 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=bBG9lgwUrPmgqsOzzaW4vKvaQj094UYKenoIEuCe488=; b=XQrnerzIhUctYGxkJiSl9d8EYU7aU0RnpjhKf0HCBJB2alyvgM37gWVpvIQULGRchp QJTUf1qbQG4CEAb4RPrEH9xxPCjd90jSn3iuRSktLQAVbvN+n6FJfG/c/MdSBmO/ckdh aUJXECw/+qcVNd27/+7UniXLbsSqL1RcaDfKQd0Zj6o304rXMX2odi4iuxvwr3oJcdPq EhEV3l6ukiguPTDPdh3GNu8ZEgTu1Oa1i2Ohi84KC6oJWApSu25fW/KRx9KxfJukA//Y vOPfXoTIkAL9RMScJuJGeDFEQstjNpUyQor48X1tymZlkhfwNVe2KMEy1/8D/YemiCQs 04rA== X-Gm-Message-State: ANhLgQ2Teqb76zqUr8UGkUPLb/DDCqx2PqYzQTqc8lpW//w0DVH0bOM1 s/TCAXeK9eJzfRR6lSuu+iG7tj4Zr1w= X-Google-Smtp-Source: ADFU+vuWjL38s5D+zWA8MILVsH3kZXbWQhF0iYpB5OzGWfDlMpmHN4g3dqRminre+Y5sLrElUyRMYBgeIek= X-Received: by 2002:adf:82ab:: with SMTP id 40mr3976785wrc.323.1585152867832; Wed, 25 Mar 2020 09:14:27 -0700 (PDT) Date: Wed, 25 Mar 2020 17:12:40 +0100 In-Reply-To: <20200325161249.55095-1-glider@google.com> Message-Id: <20200325161249.55095-30-glider@google.com> Mime-Version: 1.0 References: <20200325161249.55095-1-glider@google.com> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [PATCH v5 29/38] kmsan: enable KMSAN builds From: glider@google.com To: Jens Axboe , Andy Lutomirski , Vegard Nossum , Dmitry Vyukov , Marco Elver , Andrey Konovalov , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, aryabinin@virtuozzo.com, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, hch@lst.de, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, ebiggers@google.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, iii@linux.ibm.com, mingo@elte.hu, jasowang@redhat.com, m.szyprowski@samsung.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, mhocko@suse.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Make KMSAN usable by adding the necessary Makefile bits. Signed-off-by: Alexander Potapenko To: Alexander Potapenko Cc: Jens Axboe Cc: Andy Lutomirski Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: Marco Elver Cc: Andrey Konovalov Cc: linux-mm@kvack.org --- This patch was previously called "kmsan: Changing existing files to enable KMSAN builds". Logically unrelated parts of it were split away. v4: - split away changes to init/main.c as requested by Andrey Konovalov Change-Id: I37e0b7f2d2f2b0aeac5753ff9d6b411485fc374e --- Makefile | 3 ++- mm/Makefile | 1 + scripts/Makefile.lib | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a532333b4cd02..da315f20618b3 100644 --- a/Makefile +++ b/Makefile @@ -482,7 +482,7 @@ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE -export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN CFLAGS_KCSAN +export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN CFLAGS_KCSAN CFLAGS_KMSAN export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL @@ -901,6 +901,7 @@ KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) endif include scripts/Makefile.kasan +include scripts/Makefile.kmsan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan include scripts/Makefile.kcsan diff --git a/mm/Makefile b/mm/Makefile index fa91e963c2f9e..7b9bce9cc0afb 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_PAGE_POISONING) += page_poison.o obj-$(CONFIG_SLAB) += slab.o obj-$(CONFIG_SLUB) += slub.o obj-$(CONFIG_KASAN) += kasan/ +obj-$(CONFIG_KMSAN) += kmsan/ obj-$(CONFIG_FAILSLAB) += failslab.o obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o obj-$(CONFIG_MEMTEST) += memtest.o diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index b12dd5ba48960..e9a8c2671a4b3 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -137,6 +137,12 @@ _c_flags += $(if $(patsubst n%,, \ $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE)) endif +ifeq ($(CONFIG_KMSAN),y) +_c_flags += $(if $(patsubst n%,, \ + $(KMSAN_SANITIZE_$(basetarget).o)$(KMSAN_SANITIZE)y), \ + $(CFLAGS_KMSAN)) +endif + ifeq ($(CONFIG_UBSAN),y) _c_flags += $(if $(patsubst n%,, \ $(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)), \