Skip to contentSkip to conversation

kbuild: use interpreters to invoke scripts

RFC PATCH In review Ujjwal Kumar 2 participants 5 messages Oct 1, 2020

Subsystems (15)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kbuild: use interpreters to invoke scripts

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.

---
 Documentation/Makefile                           | 16 ++++++++--------
 Documentation/userspace-api/media/Makefile       |  6 +++---
 Makefile                                         |  4 ++--
 arch/arm64/kernel/vdso/Makefile                  |  2 +-
 arch/arm64/kernel/vdso32/Makefile                |  2 +-
 arch/ia64/Makefile                               |  4 ++--
 arch/nds32/kernel/vdso/Makefile                  |  2 +-
 .../comedi/drivers/ni_routing/tools/Makefile     |  6 +++---
 scripts/Makefile.build                           |  2 +-
 scripts/Makefile.package                         |  4 ++--
 tools/bootconfig/Makefile                        |  2 +-
 tools/bpf/Makefile.helpers                       |  2 +-
 tools/lib/bpf/Makefile                           |  2 +-
 tools/perf/Makefile.perf                         |  2 +-
 tools/power/cpupower/Makefile                    |  2 +-
 tools/testing/selftests/rcutorture/Makefile      |  2 +-
 tools/testing/selftests/rseq/Makefile            |  2 +-
 tools/testing/selftests/vm/Makefile              |  6 +++---
 tools/testing/selftests/wireguard/qemu/Makefile  |  4 ++--
 tools/testing/selftests/x86/Makefile             |  6 +++---
 20 files changed, 39 insertions(+), 39 deletions(-)
Documentation/Makefile +8 -8
index 6b12dd82f712..e74315074336 100644
@@ -7,7 +7,7 @@ subdir- := devicetree/bindings
 
 # Check for broken documentation file references
 ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
-$(shell $(srctree)/scripts/documentation-file-ref-check --warn)
+$(shell $(PERL) $(srctree)/scripts/documentation-file-ref-check --warn)
 endif
 
 # You can set these variables from the command line.
@@ -29,7 +29,7 @@ ifeq ($(HAVE_SPHINX),0)
 .DEFAULT:
 	$(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.)
 	@echo
-	@$(srctree)/scripts/sphinx-pre-install
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install
 	@echo "  SKIP    Sphinx $@ target."
 
 else # HAVE_SPHINX
@@ -78,14 +78,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
 	$(abspath $(BUILDDIR)/$3/$4)
 
 htmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
 
 linkcheckdocs:
 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
 
 latexdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
 
 ifeq ($(HAVE_PDFLATEX),0)
@@ -97,7 +97,7 @@ pdfdocs:
 else # HAVE_PDFLATEX
 
 pdfdocs: latexdocs
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	$(foreach var,$(SPHINXDIRS), \
 	   $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit; \
 	   mkdir -p $(BUILDDIR)/$(var)/pdf; \
@@ -107,11 +107,11 @@ pdfdocs: latexdocs
 endif # HAVE_PDFLATEX
 
 epubdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
 
 xmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
 
 endif # HAVE_SPHINX
@@ -120,7 +120,7 @@ endif # HAVE_SPHINX
 # work or silently pass without Sphinx.
 
 refcheckdocs:
-	$(Q)cd $(srctree);scripts/documentation-file-ref-check
+	$(Q)cd $(srctree);$(PERL) scripts/documentation-file-ref-check
 
 cleandocs:
 	$(Q)rm -rf $(BUILDDIR)
Documentation/userspace-api/media/Makefile +3 -3
index 81a4a1a53bce..5919b3e749fe 100644
@@ -13,11 +13,11 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
 TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
 
 gen_rst = \
-	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	echo $(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 silent_gen_rst = ${gen_rst}
 
Makefile +2 -2
index f93dbae71248..5f1399a576d4 100644
@@ -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
 
 # ---------------------------------------------------------------------------
arch/arm64/kernel/vdso/Makefile +1 -1
index de981f7b4546..30fe93bb5488 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +1 -1
index 572475b7b7ed..4f8fe34bc75a 100644
@@ -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 $@
arch/ia64/Makefile +2 -2
index 2876a7df1b0a..3e97ad2235d2 100644
@@ -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	= $(shell $(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
+KBUILD_CPPFLAGS += $(shell $(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	\
arch/nds32/kernel/vdso/Makefile +1 -1
index 55df25ef0057..e77d4bcfa7c1 100644
@@ -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)
drivers/staging/comedi/drivers/ni_routing/tools/Makefile +3 -3
index 6e92a06a44cb..1d4635320fdb 100644
@@ -42,14 +42,14 @@ ni_values.py: convert_c_to_py
 	./convert_c_to_py
 
 csv-files : ni_values.py comedi_h.py
-	./convert_py_to_csv.py
+	$(PYTHON3) ./convert_py_to_csv.py
 
 csv-blank :
-	./make_blank_csv.py
+	$(PYTHON3) ./make_blank_csv.py
 	@echo New blank csv signal table in csv/blank_route_table.csv
 
 c-files : comedi_h.py
-	./convert_csv_to_c.py --route_values --device_routes
+	$(PYTHON3) ./convert_csv_to_c.py --route_values --device_routes
 
 ROUTE_VALUES_SRC=$(wildcard ../ni_route_values/*.c)
 DEVICE_ROUTES_SRC=$(wildcard ../ni_device_routes/*.c)
scripts/Makefile.build +1 -1
index a467b9323442..893217ee4a17 100644
@@ -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)
scripts/Makefile.package +2 -2
index f952fb64789d..4fc16c4776cc 100644
@@ -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,$@),,                                     \
tools/bootconfig/Makefile +1 -1
index da5975775337..b6aee03a6ca9 100644
@@ -21,7 +21,7 @@ $(OUTPUT)bootconfig: main.c $(LIBSRC)
 	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
 
 test: $(ALL_PROGRAMS) test-bootconfig.sh
-	./test-bootconfig.sh $(OUTPUT)
+	$(CONFIG_SHELL) ./test-bootconfig.sh $(OUTPUT)
 
 install: $(ALL_PROGRAMS)
 	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
tools/bpf/Makefile.helpers +1 -1
index 854d084026dd..6f2b042ff719 100644
@@ -35,7 +35,7 @@ man7: $(DOC_MAN7)
 RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
 
 $(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
+	$(QUIET_GEN)$(PYTHON3) $(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
 
 $(OUTPUT)%.7: $(OUTPUT)%.rst
 ifndef RST2MAN_DEP
tools/lib/bpf/Makefile +1 -1
index f43249696d9f..8a3f7399568f 100644
@@ -179,7 +179,7 @@ $(BPF_IN_STATIC): force elfdep zdep bpfdep $(BPF_HELPER_DEFS)
 	$(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
 
 $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(srctree)/scripts/bpf_helpers_doc.py --header \
+	$(QUIET_GEN)$(PYTHON3) $(srctree)/scripts/bpf_helpers_doc.py --header \
 		--file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS)
 
 $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
tools/perf/Makefile.perf +1 -1
index 6031167939ae..42f797e541d0 100644
@@ -229,7 +229,7 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS))
 $(goals) all: sub-make
 
 sub-make: fixdep
-	@./check-headers.sh
+	$(Q)$(SHELL) ./check-headers.sh
 	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
 
 else # force_fixdep
tools/power/cpupower/Makefile +1 -1
index c7bcddbd486d..b683e774f5e3 100644
@@ -51,7 +51,7 @@ DESTDIR ?=
 # Package-related definitions. Distributions can modify the version
 # and _should_ modify the PACKAGE_BUGREPORT definition
 
-VERSION:=			$(shell ./utils/version-gen.sh)
+VERSION:=			$(shell $(CONFIG_SHELL) ./utils/version-gen.sh)
 LIB_MAJ=			0.0.1
 LIB_MIN=			0
 
tools/testing/selftests/rcutorture/Makefile +1 -1
index 5202dc666206..011a6990e8ac 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0+
 all:
-	( cd ../../../..; tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
+	( cd ../../../..; $(CONFIG_SHELL) tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
tools/testing/selftests/rseq/Makefile +1 -1
index 2af9d39a9716..6b0ae924cc7e 100644
@@ -17,7 +17,7 @@ TEST_GEN_PROGS = basic_test basic_percpu_ops_test param_test \
 
 TEST_GEN_PROGS_EXTENDED = librseq.so
 
-TEST_PROGS = run_param_test.sh
+TEST_PROGS = $(CONFIG_SHELL) run_param_test.sh
 
 TEST_FILES := settings
 
tools/testing/selftests/vm/Makefile +3 -3
index 30873b19d04b..a67a19a36cde 100644
@@ -40,9 +40,9 @@ TEST_GEN_FILES += userfaultfd
 TEST_GEN_FILES += khugepaged
 
 ifeq ($(ARCH),x86_64)
-CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
 
 TARGETS := protection_keys
 BINARIES_32 := $(TARGETS:%=%_32)
tools/testing/selftests/wireguard/qemu/Makefile +2 -2
index 4bdd6c1a19d3..d24f3efb2633 100644
@@ -255,8 +255,8 @@ $(KERNEL_BUILD_PATH)/.config: kernel.config arch/$(ARCH).config
 	printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_BUILD_PATH)/minimal.config
 	cat arch/$(ARCH).config >> $(KERNEL_BUILD_PATH)/minimal.config
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) allnoconfig
-	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
-	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
+	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
+	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
 
 $(KERNEL_BZIMAGE): $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(MUSL_PATH)/lib/libc.so $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREGUARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES)
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE)
tools/testing/selftests/x86/Makefile +3 -3
index 6703c7906b71..eb2c1025def0 100644
@@ -6,9 +6,9 @@ include ../lib.mk
 .PHONY: all all_32 all_64 warn_32bit_failure clean
 
 UNAME_M := $(shell uname -m)
-CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_program.c -no-pie)
 
 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \
 			check_initial_reg_state sigreturn iopl ioperm \
Signature · 6 lines
2.26.2

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw
Quoted 25 lines · Ujjwal Kumar

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.

---
 Documentation/Makefile                           | 16 ++++++++--------
 Documentation/userspace-api/media/Makefile       |  6 +++---
 Makefile                                         |  4 ++--
 arch/arm64/kernel/vdso/Makefile                  |  2 +-
 arch/arm64/kernel/vdso32/Makefile                |  2 +-
 arch/ia64/Makefile                               |  4 ++--
 arch/nds32/kernel/vdso/Makefile                  |  2 +-
 .../comedi/drivers/ni_routing/tools/Makefile     |  6 +++---
 scripts/Makefile.build                           |  2 +-
 scripts/Makefile.package                         |  4 ++--
 tools/bootconfig/Makefile                        |  2 +-
 tools/bpf/Makefile.helpers                       |  2 +-
 tools/lib/bpf/Makefile                           |  2 +-
Quoted 9 lines
 tools/perf/Makefile.perf                         |  2 +-
 tools/power/cpupower/Makefile                    |  2 +-
 tools/testing/selftests/rcutorture/Makefile      |  2 +-
 tools/testing/selftests/rseq/Makefile            |  2 +-
 tools/testing/selftests/vm/Makefile              |  6 +++---
 tools/testing/selftests/wireguard/qemu/Makefile  |  4 ++--
 tools/testing/selftests/x86/Makefile             |  6 +++---
 20 files changed, 39 insertions(+), 39 deletions(-)

You will probably need to split this patch into multiple patches, but the discussion will show how to split it best.

Probably:

- one for Documentation
- one for general kbuild, maybe including arch
- one for selftests
- one for the other tools
- one for the comedi driver

So, what did you do for testing your change?

Did you check if CONFIG_SHELL is actually available in tools?

Documentation/Makefile subdir- := devicetree/bindings · line 10

Quoted 10 lines
Documentation/Makefile +1 -1
index 6b12dd82f712..e74315074336 100644
@@ -7,7 +7,7 @@ subdir- := devicetree/bindings
 
 # Check for broken documentation file references
 ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
-$(shell $(srctree)/scripts/documentation-file-ref-check --warn)
+$(shell $(PERL) $(srctree)/scripts/documentation-file-ref-check --warn)

I guess you can drop shell, if you have added $(PERL).

Quoted 133 lines
Documentation/Makefile +7 -7
 endif
 
 # You can set these variables from the command line.
@@ -29,7 +29,7 @@ ifeq ($(HAVE_SPHINX),0)
 .DEFAULT:
 	$(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.)
 	@echo
-	@$(srctree)/scripts/sphinx-pre-install
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install
 	@echo "  SKIP    Sphinx $@ target."
 
 else # HAVE_SPHINX
@@ -78,14 +78,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
 	$(abspath $(BUILDDIR)/$3/$4)
 
 htmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
 
 linkcheckdocs:
 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
 
 latexdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
 
 ifeq ($(HAVE_PDFLATEX),0)
@@ -97,7 +97,7 @@ pdfdocs:
 else # HAVE_PDFLATEX
 
 pdfdocs: latexdocs
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	$(foreach var,$(SPHINXDIRS), \
 	   $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit; \
 	   mkdir -p $(BUILDDIR)/$(var)/pdf; \
@@ -107,11 +107,11 @@ pdfdocs: latexdocs
 endif # HAVE_PDFLATEX
 
 epubdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
 
 xmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
 
 endif # HAVE_SPHINX
@@ -120,7 +120,7 @@ endif # HAVE_SPHINX
 # work or silently pass without Sphinx.
 
 refcheckdocs:
-	$(Q)cd $(srctree);scripts/documentation-file-ref-check
+	$(Q)cd $(srctree);$(PERL) scripts/documentation-file-ref-check
 
 cleandocs:
 	$(Q)rm -rf $(BUILDDIR)
Documentation/userspace-api/media/Makefile +3 -3
index 81a4a1a53bce..5919b3e749fe 100644
@@ -13,11 +13,11 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
 TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
 
 gen_rst = \
-	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	echo $(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 silent_gen_rst = ${gen_rst}
 
Makefile +2 -2
index f93dbae71248..5f1399a576d4 100644
@@ -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
 
 # ---------------------------------------------------------------------------
arch/arm64/kernel/vdso/Makefile +1 -1
index de981f7b4546..30fe93bb5488 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +1 -1
index 572475b7b7ed..4f8fe34bc75a 100644
@@ -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 $@
arch/ia64/Makefile +0 -0
index 2876a7df1b0a..3e97ad2235d2 100644

arch/ia64/Makefile cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ · line 33

Quoted 8 lines
arch/ia64/Makefile +2 -2
@@ -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	= $(shell $(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
+KBUILD_CPPFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)")
 

That is duplicate. Drop shell.

arch/nds32/kernel/vdso/Makefile $(obj)/%.so: $(obj)/%.so.dbg FORCE · line 43

Quoted 13 lines
arch/ia64/Makefile +0 -0
 ifeq ($(GAS_STATUS),buggy)
 $(error Sorry, you need a newer version of the assember, one that is built from	\
arch/nds32/kernel/vdso/Makefile +1 -1
index 55df25ef0057..e77d4bcfa7c1 100644
@@ -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 > $@
 

I guess it is better to modify gen-vdsosym.

Quoted 116 lines
arch/nds32/kernel/vdso/Makefile +0 -0
 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
 	$(call if_changed,vdsosym)
drivers/staging/comedi/drivers/ni_routing/tools/Makefile +3 -3
index 6e92a06a44cb..1d4635320fdb 100644
@@ -42,14 +42,14 @@ ni_values.py: convert_c_to_py
 	./convert_c_to_py
 
 csv-files : ni_values.py comedi_h.py
-	./convert_py_to_csv.py
+	$(PYTHON3) ./convert_py_to_csv.py
 
 csv-blank :
-	./make_blank_csv.py
+	$(PYTHON3) ./make_blank_csv.py
 	@echo New blank csv signal table in csv/blank_route_table.csv
 
 c-files : comedi_h.py
-	./convert_csv_to_c.py --route_values --device_routes
+	$(PYTHON3) ./convert_csv_to_c.py --route_values --device_routes
 
 ROUTE_VALUES_SRC=$(wildcard ../ni_route_values/*.c)
 DEVICE_ROUTES_SRC=$(wildcard ../ni_device_routes/*.c)
scripts/Makefile.build +1 -1
index a467b9323442..893217ee4a17 100644
@@ -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)
scripts/Makefile.package +2 -2
index f952fb64789d..4fc16c4776cc 100644
@@ -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,$@),,                                     \
tools/bootconfig/Makefile +1 -1
index da5975775337..b6aee03a6ca9 100644
@@ -21,7 +21,7 @@ $(OUTPUT)bootconfig: main.c $(LIBSRC)
 	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
 
 test: $(ALL_PROGRAMS) test-bootconfig.sh
-	./test-bootconfig.sh $(OUTPUT)
+	$(CONFIG_SHELL) ./test-bootconfig.sh $(OUTPUT)
 
 install: $(ALL_PROGRAMS)
 	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
tools/bpf/Makefile.helpers +1 -1
index 854d084026dd..6f2b042ff719 100644
@@ -35,7 +35,7 @@ man7: $(DOC_MAN7)
 RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
 
 $(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
+	$(QUIET_GEN)$(PYTHON3) $(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
 
 $(OUTPUT)%.7: $(OUTPUT)%.rst
 ifndef RST2MAN_DEP
tools/lib/bpf/Makefile +1 -1
index f43249696d9f..8a3f7399568f 100644
@@ -179,7 +179,7 @@ $(BPF_IN_STATIC): force elfdep zdep bpfdep $(BPF_HELPER_DEFS)
 	$(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
 
 $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(srctree)/scripts/bpf_helpers_doc.py --header \
+	$(QUIET_GEN)$(PYTHON3) $(srctree)/scripts/bpf_helpers_doc.py --header \
 		--file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS)
 
 $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
tools/perf/Makefile.perf +1 -1
index 6031167939ae..42f797e541d0 100644
@@ -229,7 +229,7 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS))
 $(goals) all: sub-make
 
 sub-make: fixdep
-	@./check-headers.sh
+	$(Q)$(SHELL) ./check-headers.sh
 	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
 
 else # force_fixdep
tools/power/cpupower/Makefile +0 -0
index c7bcddbd486d..b683e774f5e3 100644

tools/power/cpupower/Makefile DESTDIR ?= · line 54

Quoted 5 lines
tools/power/cpupower/Makefile +1 -1
@@ -51,7 +51,7 @@ DESTDIR ?=
 # Package-related definitions. Distributions can modify the version
 # and _should_ modify the PACKAGE_BUGREPORT definition
 
-VERSION:=			$(shell ./utils/version-gen.sh)
+VERSION:=			$(shell $(CONFIG_SHELL) ./utils/version-gen.sh)

Duplicate shell.

Quoted 78 lines
tools/power/cpupower/Makefile +0 -0
 LIB_MAJ=			0.0.1
 LIB_MIN=			0
 
tools/testing/selftests/rcutorture/Makefile +1 -1
index 5202dc666206..011a6990e8ac 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0+
 all:
-	( cd ../../../..; tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
+	( cd ../../../..; $(CONFIG_SHELL) tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
tools/testing/selftests/rseq/Makefile +1 -1
index 2af9d39a9716..6b0ae924cc7e 100644
@@ -17,7 +17,7 @@ TEST_GEN_PROGS = basic_test basic_percpu_ops_test param_test \
 
 TEST_GEN_PROGS_EXTENDED = librseq.so
 
-TEST_PROGS = run_param_test.sh
+TEST_PROGS = $(CONFIG_SHELL) run_param_test.sh
 
 TEST_FILES := settings
 
tools/testing/selftests/vm/Makefile +3 -3
index 30873b19d04b..a67a19a36cde 100644
@@ -40,9 +40,9 @@ TEST_GEN_FILES += userfaultfd
 TEST_GEN_FILES += khugepaged
 
 ifeq ($(ARCH),x86_64)
-CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
 
 TARGETS := protection_keys
 BINARIES_32 := $(TARGETS:%=%_32)
tools/testing/selftests/wireguard/qemu/Makefile +2 -2
index 4bdd6c1a19d3..d24f3efb2633 100644
@@ -255,8 +255,8 @@ $(KERNEL_BUILD_PATH)/.config: kernel.config arch/$(ARCH).config
 	printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_BUILD_PATH)/minimal.config
 	cat arch/$(ARCH).config >> $(KERNEL_BUILD_PATH)/minimal.config
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) allnoconfig
-	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
-	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
+	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
+	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
 
 $(KERNEL_BZIMAGE): $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(MUSL_PATH)/lib/libc.so $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREGUARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES)
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE)
tools/testing/selftests/x86/Makefile +3 -3
index 6703c7906b71..eb2c1025def0 100644
@@ -6,9 +6,9 @@ include ../lib.mk
 .PHONY: all all_32 all_64 warn_32bit_failure clean
 
 UNAME_M := $(shell uname -m)
-CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_program.c -no-pie)
 
 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \
 			check_initial_reg_state sigreturn iopl ioperm \
Signature · 1 line
2.26.2

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
Quoted 44 lines · Lukas Bulwahn
Quoted 25 lines · Ujjwal Kumar

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.

---
 Documentation/Makefile                           | 16 ++++++++--------
 Documentation/userspace-api/media/Makefile       |  6 +++---
 Makefile                                         |  4 ++--
 arch/arm64/kernel/vdso/Makefile                  |  2 +-
 arch/arm64/kernel/vdso32/Makefile                |  2 +-
 arch/ia64/Makefile                               |  4 ++--
 arch/nds32/kernel/vdso/Makefile                  |  2 +-
 .../comedi/drivers/ni_routing/tools/Makefile     |  6 +++---
 scripts/Makefile.build                           |  2 +-
 scripts/Makefile.package                         |  4 ++--
 tools/bootconfig/Makefile                        |  2 +-
 tools/bpf/Makefile.helpers                       |  2 +-
 tools/lib/bpf/Makefile                           |  2 +-
Quoted 9 lines
 tools/perf/Makefile.perf                         |  2 +-
 tools/power/cpupower/Makefile                    |  2 +-
 tools/testing/selftests/rcutorture/Makefile      |  2 +-
 tools/testing/selftests/rseq/Makefile            |  2 +-
 tools/testing/selftests/vm/Makefile              |  6 +++---
 tools/testing/selftests/wireguard/qemu/Makefile  |  4 ++--
 tools/testing/selftests/x86/Makefile             |  6 +++---
 20 files changed, 39 insertions(+), 39 deletions(-)

You will probably need to split this patch into multiple patches, but the discussion will show how to split it best.

Probably:

Quoted 7 lines

- one for Documentation
- one for general kbuild, maybe including arch
- one for selftests
- one for the other tools
- one for the comedi driver

So, what did you do for testing your change?

First, I had to unset the execute bits on all files. for i in $(find -executable -type f); do chmod -x $i; done

To test the changes, I invoked the make rule under which my current changes lie. And I could see a permission-denied whenever a script was invoked. After the patch, the make rule progressed without any permissions error.
I couldn't test each and every change, because some rules failed before invoking the script and others could not be invoked by me.

I successfully tested the changes under Documentation/ (and some others).

$ make htmldocs
make[1]: execvp: ./scripts/sphinx-pre-install: Permission denied
make[1]: *** [Documentation/Makefile:81: htmldocs] Error 127
make: *** [Makefile:1661: htmldocs] Error 2

Files that I tested my changes on:

Documentation/Makefile                           | 16 ++++++++--------
Documentation/userspace-api/media/Makefile       |  6 +++---
Makefile                                         |  4 ++--
tools/perf/Makefile.perf                         |  2 +-
tools/power/cpupower/Makefile                    |  2 +-
Quoted 2 lines

Did you check if CONFIG_SHELL is actually available in tools?

Yes, I did check.
To verify, I echo(ed) the variables under a make task. And invoked the task from srctree.

Quoted 159 lines

Documentation/Makefile subdir- := devicetree/bindings · line 10

Quoted 12 lines
Documentation/Makefile +1 -1
index 6b12dd82f712..e74315074336 100644
@@ -7,7 +7,7 @@ subdir- := devicetree/bindings
 
 # Check for broken documentation file references
 ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
-$(shell $(srctree)/scripts/documentation-file-ref-check --warn)
+$(shell $(PERL) $(srctree)/scripts/documentation-file-ref-check --warn)

I guess you can drop shell, if you have added $(PERL).

Quoted 133 lines
Documentation/Makefile +7 -7
 endif
 
 # You can set these variables from the command line.
@@ -29,7 +29,7 @@ ifeq ($(HAVE_SPHINX),0)
 .DEFAULT:
 	$(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.)
 	@echo
-	@$(srctree)/scripts/sphinx-pre-install
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install
 	@echo "  SKIP    Sphinx $@ target."
 
 else # HAVE_SPHINX
@@ -78,14 +78,14 @@ quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
 	$(abspath $(BUILDDIR)/$3/$4)
 
 htmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
 
 linkcheckdocs:
 	@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
 
 latexdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
 
 ifeq ($(HAVE_PDFLATEX),0)
@@ -97,7 +97,7 @@ pdfdocs:
 else # HAVE_PDFLATEX
 
 pdfdocs: latexdocs
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	$(foreach var,$(SPHINXDIRS), \
 	   $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit; \
 	   mkdir -p $(BUILDDIR)/$(var)/pdf; \
@@ -107,11 +107,11 @@ pdfdocs: latexdocs
 endif # HAVE_PDFLATEX
 
 epubdocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
 
 xmldocs:
-	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@$(PERL) $(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
 
 endif # HAVE_SPHINX
@@ -120,7 +120,7 @@ endif # HAVE_SPHINX
 # work or silently pass without Sphinx.
 
 refcheckdocs:
-	$(Q)cd $(srctree);scripts/documentation-file-ref-check
+	$(Q)cd $(srctree);$(PERL) scripts/documentation-file-ref-check
 
 cleandocs:
 	$(Q)rm -rf $(BUILDDIR)
Documentation/userspace-api/media/Makefile +3 -3
index 81a4a1a53bce..5919b3e749fe 100644
@@ -13,11 +13,11 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
 TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
 
 gen_rst = \
-	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	echo $(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
-	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+	$(PERL) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
 
 silent_gen_rst = ${gen_rst}
 
Makefile +2 -2
index f93dbae71248..5f1399a576d4 100644
@@ -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
 
 # ---------------------------------------------------------------------------
arch/arm64/kernel/vdso/Makefile +1 -1
index de981f7b4546..30fe93bb5488 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +1 -1
index 572475b7b7ed..4f8fe34bc75a 100644
@@ -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 $@
arch/ia64/Makefile +0 -0
index 2876a7df1b0a..3e97ad2235d2 100644

arch/ia64/Makefile cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ · line 33

Quoted 8 lines
arch/ia64/Makefile +2 -2
@@ -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	= $(shell $(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
+KBUILD_CPPFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)")
 

That is duplicate. Drop shell.

Quoted 15 lines

arch/nds32/kernel/vdso/Makefile $(obj)/%.so: $(obj)/%.so.dbg FORCE · line 43

Quoted 13 lines
arch/ia64/Makefile +0 -0
 ifeq ($(GAS_STATUS),buggy)
 $(error Sorry, you need a newer version of the assember, one that is built from	\
arch/nds32/kernel/vdso/Makefile +1 -1
index 55df25ef0057..e77d4bcfa7c1 100644
@@ -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 > $@
 

I guess it is better to modify gen-vdsosym.

Do you mean something as follows:
gen-vdsosym := $(CONFIG_SHELL) $(srctree)/$(src)/gen_vdso_offsets.sh

If so, I have never seen that style in the build files. Infact, the current style is followed at many places.
For instance,
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/scripts/Makefile.lib?h=next-20201001#n398
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/tools/Makefile?h=next-20201001#n50

Quoted 198 lines
Quoted 118 lines
arch/nds32/kernel/vdso/Makefile +0 -0
 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
 	$(call if_changed,vdsosym)
drivers/staging/comedi/drivers/ni_routing/tools/Makefile +3 -3
index 6e92a06a44cb..1d4635320fdb 100644
@@ -42,14 +42,14 @@ ni_values.py: convert_c_to_py
 	./convert_c_to_py
 
 csv-files : ni_values.py comedi_h.py
-	./convert_py_to_csv.py
+	$(PYTHON3) ./convert_py_to_csv.py
 
 csv-blank :
-	./make_blank_csv.py
+	$(PYTHON3) ./make_blank_csv.py
 	@echo New blank csv signal table in csv/blank_route_table.csv
 
 c-files : comedi_h.py
-	./convert_csv_to_c.py --route_values --device_routes
+	$(PYTHON3) ./convert_csv_to_c.py --route_values --device_routes
 
 ROUTE_VALUES_SRC=$(wildcard ../ni_route_values/*.c)
 DEVICE_ROUTES_SRC=$(wildcard ../ni_device_routes/*.c)
scripts/Makefile.build +1 -1
index a467b9323442..893217ee4a17 100644
@@ -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)
scripts/Makefile.package +2 -2
index f952fb64789d..4fc16c4776cc 100644
@@ -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,$@),,                                     \
tools/bootconfig/Makefile +1 -1
index da5975775337..b6aee03a6ca9 100644
@@ -21,7 +21,7 @@ $(OUTPUT)bootconfig: main.c $(LIBSRC)
 	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
 
 test: $(ALL_PROGRAMS) test-bootconfig.sh
-	./test-bootconfig.sh $(OUTPUT)
+	$(CONFIG_SHELL) ./test-bootconfig.sh $(OUTPUT)
 
 install: $(ALL_PROGRAMS)
 	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
tools/bpf/Makefile.helpers +1 -1
index 854d084026dd..6f2b042ff719 100644
@@ -35,7 +35,7 @@ man7: $(DOC_MAN7)
 RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
 
 $(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
+	$(QUIET_GEN)$(PYTHON3) $(UP2DIR)../../scripts/bpf_helpers_doc.py --filename $< > $@
 
 $(OUTPUT)%.7: $(OUTPUT)%.rst
 ifndef RST2MAN_DEP
tools/lib/bpf/Makefile +1 -1
index f43249696d9f..8a3f7399568f 100644
@@ -179,7 +179,7 @@ $(BPF_IN_STATIC): force elfdep zdep bpfdep $(BPF_HELPER_DEFS)
 	$(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
 
 $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
-	$(QUIET_GEN)$(srctree)/scripts/bpf_helpers_doc.py --header \
+	$(QUIET_GEN)$(PYTHON3) $(srctree)/scripts/bpf_helpers_doc.py --header \
 		--file $(srctree)/tools/include/uapi/linux/bpf.h > $(BPF_HELPER_DEFS)
 
 $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
tools/perf/Makefile.perf +1 -1
index 6031167939ae..42f797e541d0 100644
@@ -229,7 +229,7 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS))
 $(goals) all: sub-make
 
 sub-make: fixdep
-	@./check-headers.sh
+	$(Q)$(SHELL) ./check-headers.sh
 	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
 
 else # force_fixdep
tools/power/cpupower/Makefile +0 -0
index c7bcddbd486d..b683e774f5e3 100644

tools/power/cpupower/Makefile DESTDIR ?= · line 54

Quoted 5 lines
tools/power/cpupower/Makefile +1 -1
@@ -51,7 +51,7 @@ DESTDIR ?=
 # Package-related definitions. Distributions can modify the version
 # and _should_ modify the PACKAGE_BUGREPORT definition
 
-VERSION:=			$(shell ./utils/version-gen.sh)
+VERSION:=			$(shell $(CONFIG_SHELL) ./utils/version-gen.sh)

Duplicate shell.

Quoted 72 lines
tools/power/cpupower/Makefile +0 -0
 LIB_MAJ=			0.0.1
 LIB_MIN=			0
 
tools/testing/selftests/rcutorture/Makefile +1 -1
index 5202dc666206..011a6990e8ac 100644
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0+
 all:
-	( cd ../../../..; tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
+	( cd ../../../..; $(CONFIG_SHELL) tools/testing/selftests/rcutorture/bin/kvm.sh --duration 10 --configs TREE01 )
tools/testing/selftests/rseq/Makefile +1 -1
index 2af9d39a9716..6b0ae924cc7e 100644
@@ -17,7 +17,7 @@ TEST_GEN_PROGS = basic_test basic_percpu_ops_test param_test \
 
 TEST_GEN_PROGS_EXTENDED = librseq.so
 
-TEST_PROGS = run_param_test.sh
+TEST_PROGS = $(CONFIG_SHELL) run_param_test.sh
 
 TEST_FILES := settings
 
tools/testing/selftests/vm/Makefile +3 -3
index 30873b19d04b..a67a19a36cde 100644
@@ -40,9 +40,9 @@ TEST_GEN_FILES += userfaultfd
 TEST_GEN_FILES += khugepaged
 
 ifeq ($(ARCH),x86_64)
-CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(CONFIG_SHELL) ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie)
 
 TARGETS := protection_keys
 BINARIES_32 := $(TARGETS:%=%_32)
tools/testing/selftests/wireguard/qemu/Makefile +2 -2
index 4bdd6c1a19d3..d24f3efb2633 100644
@@ -255,8 +255,8 @@ $(KERNEL_BUILD_PATH)/.config: kernel.config arch/$(ARCH).config
 	printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_BUILD_PATH)/minimal.config
 	cat arch/$(ARCH).config >> $(KERNEL_BUILD_PATH)/minimal.config
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) allnoconfig
-	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
-	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
+	cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config
+	$(if $(findstring yes,$(DEBUG_KERNEL)),cp debug.config $(KERNEL_BUILD_PATH) && cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(CONFIG_SHELL) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config debug.config,)
 
 $(KERNEL_BZIMAGE): $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(MUSL_PATH)/lib/libc.so $(IPERF_PATH)/src/iperf3 $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/misc/ss $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-legacy-multi $(NMAP_PATH)/ncat/ncat $(WIREGUARD_TOOLS_PATH)/src/wg $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES)
 	$(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE)
tools/testing/selftests/x86/Makefile +3 -3
index 6703c7906b71..eb2c1025def0 100644
@@ -6,9 +6,9 @@ include ../lib.mk
 .PHONY: all all_32 all_64 warn_32bit_failure clean
 
 UNAME_M := $(shell uname -m)
-CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
-CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
-CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie)
+CAN_BUILD_I386 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
+CAN_BUILD_X86_64 := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_64bit_program.c)
+CAN_BUILD_WITH_NOPIE := $(shell $(SHELL) ./check_cc.sh $(CC) trivial_program.c -no-pie)
 
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/x86/Makefile +0 -0
 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \
 			check_initial_reg_state sigreturn iopl ioperm \
Signature · 1 line
2.26.2

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw
Quoted 56 lines · Ujjwal Kumar
Quoted 44 lines · Lukas Bulwahn
Quoted 25 lines · Ujjwal Kumar

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.

---
 Documentation/Makefile                           | 16 ++++++++--------
 Documentation/userspace-api/media/Makefile       |  6 +++---
 Makefile                                         |  4 ++--
 arch/arm64/kernel/vdso/Makefile                  |  2 +-
 arch/arm64/kernel/vdso32/Makefile                |  2 +-
 arch/ia64/Makefile                               |  4 ++--
 arch/nds32/kernel/vdso/Makefile                  |  2 +-
 .../comedi/drivers/ni_routing/tools/Makefile     |  6 +++---
 scripts/Makefile.build                           |  2 +-
 scripts/Makefile.package                         |  4 ++--
 tools/bootconfig/Makefile                        |  2 +-
 tools/bpf/Makefile.helpers                       |  2 +-
 tools/lib/bpf/Makefile                           |  2 +-
Quoted 9 lines
 tools/perf/Makefile.perf                         |  2 +-
 tools/power/cpupower/Makefile                    |  2 +-
 tools/testing/selftests/rcutorture/Makefile      |  2 +-
 tools/testing/selftests/rseq/Makefile            |  2 +-
 tools/testing/selftests/vm/Makefile              |  6 +++---
 tools/testing/selftests/wireguard/qemu/Makefile  |  4 ++--
 tools/testing/selftests/x86/Makefile             |  6 +++---
 20 files changed, 39 insertions(+), 39 deletions(-)

You will probably need to split this patch into multiple patches, but the discussion will show how to split it best.

Probably:

Quoted 7 lines

- one for Documentation
- one for general kbuild, maybe including arch
- one for selftests
- one for the other tools
- one for the comedi driver

So, what did you do for testing your change?

First, I had to unset the execute bits on all files. for i in $(find -executable -type f); do chmod -x $i; done

Quoted 7 lines

To test the changes, I invoked the make rule under which my current changes lie. And I could see a permission-denied whenever a script was invoked. After the patch, the make rule progressed without any permissions error.
I couldn't test each and every change, because some rules failed before invoking the script and others could not be invoked by me.

Which could you not test? Please share that.

Quoted 16 lines

I successfully tested the changes under Documentation/ (and some others).

$ make htmldocs
make[1]: execvp: ./scripts/sphinx-pre-install: Permission denied
make[1]: *** [Documentation/Makefile:81: htmldocs] Error 127
make: *** [Makefile:1661: htmldocs] Error 2

Files that I tested my changes on:

Documentation/Makefile                           | 16 ++++++++--------
Documentation/userspace-api/media/Makefile       |  6 +++---
Makefile                                         |  4 ++--
tools/perf/Makefile.perf                         |  2 +-
tools/power/cpupower/Makefile                    |  2 +-
Quoted 1 line
Quoted 6 lines
Quoted 1 line

Did you check if CONFIG_SHELL is actually available in tools?

Yes, I did check.
To verify, I echo(ed) the variables under a make task. And invoked the task from srctree.

That sounds good.

Quoted 12 lines
Quoted 11 lines

arch/nds32/kernel/vdso/Makefile $(obj)/%.so: $(obj)/%.so.dbg FORCE · line 43

Quoted 9 lines
arch/nds32/kernel/vdso/Makefile +1 -1
@@ -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 > $@
 

I guess it is better to modify gen-vdsosym.

Quoted 9 lines

Do you mean something as follows:
gen-vdsosym := $(CONFIG_SHELL) $(srctree)/$(src)/gen_vdso_offsets.sh

If so, I have never seen that style in the build files. Infact, the current style is followed at many places.
For instance,
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/scripts/Makefile.lib?h=next-20201001#n398
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/tools/Makefile?h=next-20201001#n50

I searched around as well. I think your proposal is fine.

How about splitting out a first patch on the generic kbuild files and send that out as RFC, first send the RFC patch to linux-kernel-mentees list, then if that looks good, we go for Masahiro and the linux-kbuild list?

Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#4 lore raw
Quoted 68 lines · Lukas Bulwahn
Quoted 56 lines · Ujjwal Kumar
Quoted 44 lines · Lukas Bulwahn
Quoted 25 lines · Ujjwal Kumar

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.

---
 Documentation/Makefile                           | 16 ++++++++--------
 Documentation/userspace-api/media/Makefile       |  6 +++---
 Makefile                                         |  4 ++--
 arch/arm64/kernel/vdso/Makefile                  |  2 +-
 arch/arm64/kernel/vdso32/Makefile                |  2 +-
 arch/ia64/Makefile                               |  4 ++--
 arch/nds32/kernel/vdso/Makefile                  |  2 +-
 .../comedi/drivers/ni_routing/tools/Makefile     |  6 +++---
 scripts/Makefile.build                           |  2 +-
 scripts/Makefile.package                         |  4 ++--
 tools/bootconfig/Makefile                        |  2 +-
 tools/bpf/Makefile.helpers                       |  2 +-
 tools/lib/bpf/Makefile                           |  2 +-
Quoted 9 lines
 tools/perf/Makefile.perf                         |  2 +-
 tools/power/cpupower/Makefile                    |  2 +-
 tools/testing/selftests/rcutorture/Makefile      |  2 +-
 tools/testing/selftests/rseq/Makefile            |  2 +-
 tools/testing/selftests/vm/Makefile              |  6 +++---
 tools/testing/selftests/wireguard/qemu/Makefile  |  4 ++--
 tools/testing/selftests/x86/Makefile             |  6 +++---
 20 files changed, 39 insertions(+), 39 deletions(-)

You will probably need to split this patch into multiple patches, but the discussion will show how to split it best.

Probably:

Quoted 7 lines

- one for Documentation
- one for general kbuild, maybe including arch
- one for selftests
- one for the other tools
- one for the comedi driver

So, what did you do for testing your change?

First, I had to unset the execute bits on all files. for i in $(find -executable -type f); do chmod -x $i; done

Quoted 7 lines

To test the changes, I invoked the make rule under which my current changes lie. And I could see a permission-denied whenever a script was invoked. After the patch, the make rule progressed without any permissions error.
I couldn't test each and every change, because some rules failed before invoking the script and others could not be invoked by me.

Quoted 1 line

Which could you not test? Please share that.

arch/arm64/kernel/vdso/Makefile arch/arm64/kernel/vdso32/Makefile arch/ia64/Makefile arch/nds32/kernel/vdso/Makefile drivers/staging/comedi/drivers/ni_routing/tools/Makefile scripts/Makefile.build
scripts/Makefile.package tools/bootconfig/Makefile tools/bpf/Makefile.helpers tools/lib/bpf/Makefile tools/testing/selftests/rcutorture/Makefile tools/testing/selftests/rseq/Makefile tools/testing/selftests/vm/Makefile tools/testing/selftests/wireguard/qemu/Makefile tools/testing/selftests/x86/Makefile

Quoted 48 lines
Quoted 17 lines

I successfully tested the changes under Documentation/ (and some others).

$ make htmldocs
make[1]: execvp: ./scripts/sphinx-pre-install: Permission denied
make[1]: *** [Documentation/Makefile:81: htmldocs] Error 127
make: *** [Makefile:1661: htmldocs] Error 2

Files that I tested my changes on:

Documentation/Makefile                           | 16 ++++++++--------
Documentation/userspace-api/media/Makefile       |  6 +++---
Makefile                                         |  4 ++--
tools/perf/Makefile.perf                         |  2 +-
tools/power/cpupower/Makefile                    |  2 +-
Quoted 1 line
Quoted 6 lines
Quoted 1 line

Did you check if CONFIG_SHELL is actually available in tools?

Yes, I did check.
To verify, I echo(ed) the variables under a make task. And invoked the task from srctree.

That sounds good.

Quoted 12 lines
Quoted 11 lines

arch/nds32/kernel/vdso/Makefile $(obj)/%.so: $(obj)/%.so.dbg FORCE · line 43

Quoted 9 lines
arch/nds32/kernel/vdso/Makefile +1 -1
@@ -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 > $@
 

I guess it is better to modify gen-vdsosym.

Quoted 9 lines

Do you mean something as follows:
gen-vdsosym := $(CONFIG_SHELL) $(srctree)/$(src)/gen_vdso_offsets.sh

If so, I have never seen that style in the build files. Infact, the current style is followed at many places.
For instance,
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/scripts/Makefile.lib?h=next-20201001#n398
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/tools/Makefile?h=next-20201001#n50

Quoted 8 lines

I searched around as well. I think your proposal is fine.

How about splitting out a first patch on the generic kbuild files and send that out as RFC, first send the RFC patch to linux-kernel-mentees list, then if that looks good, we go for Masahiro and the linux-kbuild list?

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees