Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1397372pxk; Thu, 10 Sep 2020 14:23:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynadSw7+bHAur6thFZclonUeAMQukMI9S4jC+WWJy79a1dl4/tC+tSEdzZW9eRL8Pn+u1l X-Received: by 2002:a50:c051:: with SMTP id u17mr10653593edd.39.1599773006333; Thu, 10 Sep 2020 14:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599773006; cv=none; d=google.com; s=arc-20160816; b=kCDsm+F8178ImerLc/cW+9OBZRFD1pEwAUp50wOAUEX7YTlJxRrcERe9nI/v0f1z9S Tfo2tDPGy9aCe2R97ywpLFYwceIykISPLyNKHXwKqT3K1WMttr0Nwq8wjLXxH0kZJNN7 qyNgM4ChRurW+c1cBqf274P+McSC8TVUvWfHL3+n1PbeoOHEZsPmDnDeMgLJIPbOaogo mChxg0GD55YBbaVFEjium5FYiJYkDw95dmeESLr8oRTyw21I1h+GBo1n/vM4hVNLh56I EYOeM6i/nL7oCUmArHUpDvZQnNZiz/uSHylI/2M6R4T7/C6k+AffKCdEQb4WzZyKVcHD tThg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kcGVZn8a+TssCx5V7/oWyKJ/qM6HLG6mmAZ+V9sySx8=; b=g6Bj3mqH5NuFU54KiTG5YBsrSZ4i2GNzx6+YLkqHCYPyBJTeVbGqD6KApwoDkPL+/I dQcPIA7pnROgbMtduIULoB20m+d4X/ckCaqWusE/wweKX2G1owzi5FRgZXtBze9MzYaR 5H3LlYqKSnmiU2qI8gJea97cOMdiiR09du4fqBRdTxzR5ds0mo7puXXfgOdHjPJtW5xn rztcXbcexPBWGR2vFKuIXGQz42JXSrRjRYUsNAnhTQ7lKoPvn/FIrzpRxzf1xnnLyY/g HEM/lN4gLJrLJzz9i9Ju7/75l1CtVQgY+CWJzeIzX+pXQXLFdQ6y9/2gjDhLxZ7t38iS ZDwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="c/e5qR7L"; 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 du1si4628147ejc.562.2020.09.10.14.23.03; Thu, 10 Sep 2020 14:23:26 -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="c/e5qR7L"; 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 S1728229AbgIJVVw (ORCPT + 99 others); Thu, 10 Sep 2020 17:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731117AbgIJOYO (ORCPT ); Thu, 10 Sep 2020 10:24:14 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A50C061387 for ; Thu, 10 Sep 2020 07:12:14 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id y5so5460991otg.5 for ; Thu, 10 Sep 2020 07:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kcGVZn8a+TssCx5V7/oWyKJ/qM6HLG6mmAZ+V9sySx8=; b=c/e5qR7LPEjderXek+U3xgTpgL77Qrfecxnb6dt5fDoSQpfDhVsU5hfdVc/DB8V8e5 rt4nLO3Hk3YaGq0en00R7yN6TLbP6H2kZO7HEXL9nS7++wkphfursXDVygtlT1GWEmot gehKBV+biiux876gKHzHTwMIX+zkCmuMD7eH0RZigPBf+MqU+nFiCMBZSYGZmY+tVJlF aqt9xW4BOX61FwxN0R4Abz0tI0uYLlnkoi88XvNZYWL30aI7hlWeoI0Tl7TZC1f2ffYb 8qtU+itM2eSEB4zMZqI0PBK+i5O6AK7DfNiUX5UoXj0lNiWI6RolOOFuyDzd6eHRvDQL 7Qww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kcGVZn8a+TssCx5V7/oWyKJ/qM6HLG6mmAZ+V9sySx8=; b=rIj8UtyuBwbBH3NkaNX3MWBkWNP7WZAW1NsEhpdA2HsqZUkJb3DgqWjrd3JmC/+rvR ZYhcAhYHETo2wouWQnEpsag5KTso0Jhu3LJJFOrcm6GDVG8crIb2mRnuohwenYBij0kk bY8HaSMyyaMCOxzlK4RXctkk1/LvKZECMW3/j31lj1eBwyKeA39mt2gi26WCtIfDVTH6 ad0YJk4v/kBYzNhI/TCI2/isjO0odC1OAeg+H6s1Grs0wwx8KWtPqFOeF7bCDU77b6N9 jVayEzzpzuYXGKkq4uO9jECFygmE/enSsMvsFE5OI0hMFnvyY+3IhohAABq4A5yerkfJ OObg== X-Gm-Message-State: AOAM533S+QRLBtw1jpjK8UvRxc3HaWJHi9xv562D1CDLOoS4BVLKniqu 3uHIGnr232qJCEh8xlCXvtp4Q86t5Nc47fCwofcrSg== X-Received: by 2002:a9d:3da1:: with SMTP id l30mr4255115otc.233.1599747133357; Thu, 10 Sep 2020 07:12:13 -0700 (PDT) MIME-Version: 1.0 References: <20200910134429.3525408-1-masahiroy@kernel.org> <20200910134429.3525408-2-masahiroy@kernel.org> In-Reply-To: <20200910134429.3525408-2-masahiroy@kernel.org> From: Marco Elver Date: Thu, 10 Sep 2020 16:12:01 +0200 Message-ID: Subject: Re: [PATCH 2/2] kbuild: move CFLAGS_{KASAN,UBSAN,KCSAN} exports to relevant Makefiles To: Masahiro Yamada Cc: Linux Kbuild mailing list , Ingo Molnar , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , Michal Marek , kasan-dev , LKML , "Paul E. McKenney" 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 On Thu, 10 Sep 2020 at 15:45, Masahiro Yamada wrote: > > Move CFLAGS_KASAN*, CFLAGS_UBSAN, CFLAGS_KCSAN to Makefile.kasan, > Makefile.ubsan, Makefile.kcsan, respectively. > > This commit also avoids the same -fsanitize=* flags being added to > CFLAGS_UBSAN multiple times. > > Prior to this commit, the ubsan flags were appended by the '+=' > operator, without any initialization. Some build targets such as > 'make bindeb-pkg' recurses to the top Makefile, and ended up with > adding the same flags to CFLAGS_UBSAN twice. > > Clear CFLAGS_UBSAN with ':=' to make it a simply expanded variable. > This is better than a recursively expanded variable, which evaluates > $(call cc-option, ...) multiple times before Kbuild starts descending > to subdirectories. > > Signed-off-by: Masahiro Yamada > --- > > Makefile | 1 - > scripts/Makefile.kasan | 2 ++ > scripts/Makefile.kcsan | 2 +- > scripts/Makefile.ubsan | 3 +++ > 4 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index ec2330ce0fc5..4b5a305e30d2 100644 > --- a/Makefile > +++ b/Makefile > @@ -517,7 +517,6 @@ 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 KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE > export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE > export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL > diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan > index 1532f1a41a8f..1e000cc2e7b4 100644 > --- a/scripts/Makefile.kasan > +++ b/scripts/Makefile.kasan > @@ -47,3 +47,5 @@ CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ > $(instrumentation_flags) > > endif # CONFIG_KASAN_SW_TAGS > + > +export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE > diff --git a/scripts/Makefile.kcsan b/scripts/Makefile.kcsan > index c50f27b3ac56..cec50d74e0d0 100644 > --- a/scripts/Makefile.kcsan > +++ b/scripts/Makefile.kcsan > @@ -9,7 +9,7 @@ endif > > # Keep most options here optional, to allow enabling more compilers if absence > # of some options does not break KCSAN nor causes false positive reports. > -CFLAGS_KCSAN := -fsanitize=thread \ > +export CFLAGS_KCSAN := -fsanitize=thread \ > $(call cc-option,$(call cc-param,tsan-instrument-func-entry-exit=0) -fno-optimize-sibling-calls) \ > $(call cc-option,$(call cc-param,tsan-instrument-read-before-write=1)) \ > $(call cc-param,tsan-distinguish-volatile=1) This doesn't apply to -next, which has some KCSAN changes for the next merge window. Although it seems git-merge figures out the resolution for the conflict automatically. Other than that, Acked-by: Marco Elver Thank you! > diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan > index 27348029b2b8..c661484ee01f 100644 > --- a/scripts/Makefile.ubsan > +++ b/scripts/Makefile.ubsan > @@ -1,4 +1,7 @@ > # SPDX-License-Identifier: GPL-2.0 > + > +export CFLAGS_UBSAN := > + > ifdef CONFIG_UBSAN_ALIGNMENT > CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) > endif > -- > 2.25.1 >