Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2480672pxk; Sun, 4 Oct 2020 00:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwniR/mc6B4JZ5JRa6RhB4jpyeYvwvj+CcHWmBB5jBDPy1+yTCTYAnUR9UJYrx/gAyymX+f X-Received: by 2002:a17:906:4902:: with SMTP id b2mr9625497ejq.208.1601797360835; Sun, 04 Oct 2020 00:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601797360; cv=none; d=google.com; s=arc-20160816; b=ONzE/jCFM+nYaWjLbfQNK+S90vpbAqN/tQvkC/ZSeuZz3zZFrqnMCe8O2SNdSJGHvZ vEBl8Oq4indDnCgvNpxVqwg0qhuFH7LDtELTT/1i0KKE/IFXqjx//o2or5sXdKVRI5Iz +ghIR1UjeFOpGUC8lLHpbR75Dg3gXCNuM2U7JmSrsJ/EqYAzkrnN/NY1Geauvb5ObiBM s9nPLTrXxYEcBbYvWymLOoL0nzoERyPtY/nUvJb/qyM55Oyl8Ei9xOdMf1GTR5ARgGae afHjhT4eaSk7dnguMXPju2NwyzqgY72zZWPGPURU8Jp+hSCPtiVE3BK4K8N/jpT8uQlL GVhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KeIBefhZsCRO4ge0tnlcVP1csYq2ZaieViEu5oQdjWM=; b=V2jcKiCwFhCIwlK+SgjbXfKasTDmMpcRxTl1goZ5Oe2GSxkMB8Jak/EpbMmZ038CFy 741HVURyxIJDkQ58K7JbSsKfSZxMwDXULbMrPh1wo2fXVvVXXPlSbbn36UH35c+F2j+Q c0Q3HGYyrD2nJWAiyDmNEK/AMXJeIpmISFlzX7Sg/VpDKKalewCfM3PZQO5VkCm43+we IOO2PNBwwsBWB5egW6MzRGghhFnByH7a/4pMtxZwX5ObbE64tSphDOFCiruPnIOzjZGm 2raQpQOkpmmRW//CFEfymxuYU1fo9fl1HN/CbfpMbt9X3s/42WQXywxidCiWXpf7V6kH BG+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KZ79Zwex; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si5126215ejp.43.2020.10.04.00.42.17; Sun, 04 Oct 2020 00:42:40 -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=@gmail.com header.s=20161025 header.b=KZ79Zwex; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725880AbgJDHiC (ORCPT + 99 others); Sun, 4 Oct 2020 03:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgJDHiB (ORCPT ); Sun, 4 Oct 2020 03:38:01 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B20CC0613CE; Sun, 4 Oct 2020 00:38:01 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id i3so3431346pjz.4; Sun, 04 Oct 2020 00:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KeIBefhZsCRO4ge0tnlcVP1csYq2ZaieViEu5oQdjWM=; b=KZ79ZwexBZCSaikyMHyLbQYpztvjAwRxiBnOp6vvicTtkLRGK/2jNxyI0b8MwBllXc QpDxO5YsDeO0Lxyqpjl7O7aNTJARNrjf0XiPSq98tIZATqWFfvh9dkrcWD07DUpSKMff I2MDipSqOhK/rPJBLer6j7yo8gqiYUJ9zjzYtrG1J2JXgx9nLtUb8HNb6zZgySjz4l8F bQDV6bZBwiu8nXI3+oZcwqekNjtyB6XUEvHlYxwsJge2FYo2VDMqnkRP2G1hkkAbwLSa rAfoxQInZHmQaTawHfX1RfIE7zMOt8LBfPNDezijQPqyFBTSBnee+s5VlNAOB1CvKqZQ Lf5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KeIBefhZsCRO4ge0tnlcVP1csYq2ZaieViEu5oQdjWM=; b=OBwqkUhRtBRMrQurnpURcfyK2leZOYDkw1jZd2+YJIPMAVXwn5kTnjFMKqGTmL6hOa wv82eE6I923go6Vkha57IeeQAFoMQTR0/8bHomN/h/6wQ8hpauMP7cXzHC5hDdAMGldX b5itJG+WJnvyeAtRQ456uKLloVDqNizD/UpGTxTGV2b8fxLBs2bxg6+god9P5vGZXNRp tt1Y25lUg838PJUTQRByoNjJ2aMyeEi6pNRpRA1cqwXllTpIRZHe9m1CJVfnIhk9lEQJ NoBoxDZcWggSkbxqokb0SpPWRltrPvHIaEL2KPXmUJEnMr91dgTTiHCVaVilYgjqQB0j 65HA== X-Gm-Message-State: AOAM532uNw4ynt7mrQJPc/89Y6xi19l3cFB0GcoFBhlgXy4wcx62iiAs +cMV53F9dTkghktoIcqekltVlWtbMYBZ4A== X-Received: by 2002:a17:90a:f187:: with SMTP id bv7mr9914620pjb.198.1601797081067; Sun, 04 Oct 2020 00:38:01 -0700 (PDT) Received: from Ryzen-9-3900X.localdomain (ip68-3-136-221.ph.ph.cox.net. [68.3.136.221]) by smtp.gmail.com with ESMTPSA id x17sm4774092pfj.1.2020.10.04.00.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2020 00:38:00 -0700 (PDT) Date: Sun, 4 Oct 2020 00:37:57 -0700 From: Nathan Chancellor To: Ujjwal Kumar Cc: Masahiro Yamada , Michal Marek , Andrew Morton , Kees Cook , Lukas Bulwahn , Nick Desaulniers , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH RFC 2/2] kbuild: use interpreters to invoke scripts Message-ID: <20201004073757.GA31746@Ryzen-9-3900X.localdomain> References: <979bb7b0-2cae-3cd7-2fbd-7fcece9aafd1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <979bb7b0-2cae-3cd7-2fbd-7fcece9aafd1@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 03, 2020 at 08:51:23PM +0530, Ujjwal Kumar wrote: > We cannot rely on execute bits to be set on files in the repository. > The build script should use the explicit interpreter when invoking any > script from the repository. > > Link: https://lore.kernel.org/lkml/20200830174409.c24c3f67addcce0cea9a9d4c@linux-foundation.org/ > Link: https://lore.kernel.org/lkml/202008271102.FEB906C88@keescook/ > > Suggested-by: Andrew Morton > Suggested-by: Kees Cook > Suggested-by: Lukas Bulwahn > Signed-off-by: Ujjwal Kumar Reviewed-by: Nathan Chancellor > --- > Makefile | 4 ++-- > arch/arm64/kernel/vdso/Makefile | 2 +- > arch/arm64/kernel/vdso32/Makefile | 2 +- > arch/ia64/Makefile | 4 ++-- > arch/nds32/kernel/vdso/Makefile | 2 +- > scripts/Makefile.build | 2 +- > scripts/Makefile.package | 4 ++-- > 7 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/Makefile b/Makefile > index f93dbae71248..5f1399a576d4 100644 > --- a/Makefile > +++ b/Makefile > @@ -1258,7 +1258,7 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE > PHONY += headerdep > headerdep: > $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ > - $(srctree)/scripts/headerdep.pl -I$(srctree)/include > + $(PERL) $(srctree)/scripts/headerdep.pl -I$(srctree)/include > > # --------------------------------------------------------------------------- > # Kernel headers > @@ -1314,7 +1314,7 @@ PHONY += kselftest-merge > kselftest-merge: > $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!)) > $(Q)find $(srctree)/tools/testing/selftests -name config | \ > - xargs $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config > + xargs $(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config > $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig > > # --------------------------------------------------------------------------- > diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile > index de981f7b4546..30fe93bb5488 100644 > --- a/arch/arm64/kernel/vdso/Makefile > +++ b/arch/arm64/kernel/vdso/Makefile > @@ -65,7 +65,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE > # Generate VDSO offsets using helper script > gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > - cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ > + cmd_vdsosym = $(NM) $< | $(CONFIG_SHELL) $(gen-vdsosym) | LC_ALL=C sort > $@ > > include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE > $(call if_changed,vdsosym) > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 572475b7b7ed..4f8fe34bc75a 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -205,7 +205,7 @@ quiet_cmd_vdsomunge = MUNGE $@ > gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > # The AArch64 nm should be able to read an AArch32 binary > - cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ > + cmd_vdsosym = $(NM) $< | $(CONFIG_SHELL) $(gen-vdsosym) | LC_ALL=C sort > $@ > > # Install commands for the unstripped file > quiet_cmd_vdso_install = INSTALL32 $@ > diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile > index 2876a7df1b0a..5f6cc3c3da50 100644 > --- a/arch/ia64/Makefile > +++ b/arch/ia64/Makefile > @@ -28,8 +28,8 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ > -falign-functions=32 -frename-registers -fno-optimize-sibling-calls > KBUILD_CFLAGS_KERNEL := -mconstant-gp > > -GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") > -KBUILD_CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") > +GAS_STATUS = $($(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") > +KBUILD_CPPFLAGS += $($(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") > > ifeq ($(GAS_STATUS),buggy) > $(error Sorry, you need a newer version of the assember, one that is built from \ > diff --git a/arch/nds32/kernel/vdso/Makefile b/arch/nds32/kernel/vdso/Makefile > index 55df25ef0057..e77d4bcfa7c1 100644 > --- a/arch/nds32/kernel/vdso/Makefile > +++ b/arch/nds32/kernel/vdso/Makefile > @@ -39,7 +39,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE > # Generate VDSO offsets using helper script > gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > - cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ > + cmd_vdsosym = $(NM) $< | $(CONFIG_SHELL) $(gen-vdsosym) | LC_ALL=C sort > $@ > > include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE > $(call if_changed,vdsosym) > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index a467b9323442..893217ee4a17 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -104,7 +104,7 @@ else ifeq ($(KBUILD_CHECKSRC),2) > endif > > ifneq ($(KBUILD_EXTRA_WARN),) > - cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< > + cmd_checkdoc = $(PERL) $(srctree)/scripts/kernel-doc -none $< > endif > > # Compile C sources (.c) > diff --git a/scripts/Makefile.package b/scripts/Makefile.package > index f952fb64789d..4fc16c4776cc 100644 > --- a/scripts/Makefile.package > +++ b/scripts/Makefile.package > @@ -44,7 +44,7 @@ if test "$(objtree)" != "$(srctree)"; then \ > echo >&2; \ > false; \ > fi ; \ > -$(srctree)/scripts/setlocalversion --save-scmversion; \ > +$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion; \ > tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ > --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ > rm -f $(objtree)/.scmversion > @@ -123,7 +123,7 @@ git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \ > mkdir -p $(perf-tar); \ > git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ > (cd $(srctree)/tools/perf; \ > -util/PERF-VERSION-GEN $(CURDIR)/$(perf-tar)/); \ > +$(CONFIG_SHELL) util/PERF-VERSION-GEN $(CURDIR)/$(perf-tar)/); \ > tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \ > rm -r $(perf-tar); \ > $(if $(findstring tar-src,$@),, \ > -- > 2.26.2 >