From patchwork Fri Dec 20 18:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11306199 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 5CCB51580 for ; Fri, 20 Dec 2019 18:51:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CD6B21D7D for ; Fri, 20 Dec 2019 18:51:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IH3rY9Pk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CD6B21D7D 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 0591F8E01C4; Fri, 20 Dec 2019 13:51:49 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 030258E019D; Fri, 20 Dec 2019 13:51:49 -0500 (EST) 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 E8AC38E01C4; Fri, 20 Dec 2019 13:51:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id D4D318E019D for ; Fri, 20 Dec 2019 13:51:48 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 9FB9E181AEF15 for ; Fri, 20 Dec 2019 18:51:48 +0000 (UTC) X-FDA: 76286413896.28.sugar51_842dab30ac84b X-Spam-Summary: 2,0,0,6b78317969c81bc6,d41d8cd98f00b204,3qhj9xqykcf0bgd89mbjjbg9.7jhgdips-hhfq57f.jmb@flex--glider.bounces.google.com,:axboe@kernel.dk:luto@kernel.org:vegard.nossum@oracle.com:dvyukov@google.com:elver@google.com:andreyknvl@google.com::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.c om:tytso X-HE-Tag: sugar51_842dab30ac84b X-Filterd-Recvd-Size: 6354 Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Dec 2019 18:51:48 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id f22so3454472qka.10 for ; Fri, 20 Dec 2019 10:51:48 -0800 (PST) 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=yxZttir6sdXGsd981kjJUWW+6gYYoLrQMxRX6mzi4HE=; b=IH3rY9Pk1iR58o2fHxVeuMN7Y/vleMLf1dNVcR4lgEFQjKJFMUNgtMUUL4b2dsuOCb fIdmd9vSkI2GiS3dr9tCqga2JNbiEUztDOrMAuShVHAZiz8iLAIv2hiSKLdTmQzdeOVE DtdokmcU7i/0jOWJxRXZoZ3JLyOiBOJ8Ivh4fGD/D88tv02mv1HbMj8H1OuEtt0s08FE oc4i5sbyVfQ4PFt6jbdrUcDk96ugUAA+yeIdz5XfzXJoDCweABkUMq+tLaM8AGKJHnu0 jlg6CXh76f1bq5jjDn0m6SkEIfektBu93owxv0qTXaRlCGvzVTDxEDmqA3EYzCJp4ude kxlA== 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=yxZttir6sdXGsd981kjJUWW+6gYYoLrQMxRX6mzi4HE=; b=oBKopuessl80bBxf1XfN1AE59SMh0K56TlHnk+Nyhe6zHVQoVHIj00+l6wC/Bj39uK +3E3bUlsuZkp3PR8rcvOSp+YX9G9UQR0mwHtNf3vrp7woU7EH2D4MVoeBusqL1A398Rz tZLq+FGk7kLIA/NXpT/zvfcLdQIzeVaUW7Zu9z3wzzuP4eRgN26YsnqpGsKkUu9TSqYM HnJbCGuOJnc2ru8TwxlK0+7NIBxPCFGRdDHFBunJ7ot+dZ16dR2KhUo3NE09GV+4tw0E ZZR7RMbU9qcEluFOFnXJkPBbKwe1EM9V3FoPa0h0MnXZ396mjyMpXn5Q+rdP4Tk2Gv9N 5Phw== X-Gm-Message-State: APjAAAW7uFllApv06DRifXV9JDCQr1FwiJ/UbH4hu2X6tfqb0+c8zBCx yJocm3IGguy/1QmoxPfbo6N48DmIcGs= X-Google-Smtp-Source: APXvYqyIDwENNSTY1nMD9kFad/veXTGS7BOBQpb96Y0sw5pE1q+U/462dmFiZBjNmCNHcSYs70Zv07GPihM= X-Received: by 2002:a37:5fc2:: with SMTP id t185mr14430896qkb.271.1576867906722; Fri, 20 Dec 2019 10:51:46 -0800 (PST) Date: Fri, 20 Dec 2019 19:49:46 +0100 In-Reply-To: <20191220184955.223741-1-glider@google.com> Message-Id: <20191220184955.223741-34-glider@google.com> Mime-Version: 1.0 References: <20191220184955.223741-1-glider@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH RFC v4 33/42] 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 73e3c2802927..cd77b3ee6238 100644 --- a/Makefile +++ b/Makefile @@ -478,7 +478,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 +export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN 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 @@ -897,6 +897,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 diff --git a/mm/Makefile b/mm/Makefile index 1937cc251883..31c7ed675497 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -71,6 +71,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 3fa32f83b2d7..ca9d2d0ef3fb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -126,6 +126,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)), \