From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: Ujjwal Kumar <ujjwalkumar0501@gmail.com>
Cc: Michal Marek <michal.lkml@markovi.net>,
linux-ia64@vger.kernel.org, Kees Cook <keescook@chromium.org>,
linux-kbuild@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
Nathan Chancellor <natechancellor@gmail.com>,
linux-kernel-mentees@lists.linuxfoundation.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [Linux-kernel-mentees] [PATCH v2 2/2] kbuild: use interpreters to invoke scripts
Date: Mon, 12 Oct 2020 18:54:30 +0000 [thread overview]
Message-ID: <53b7257e-b192-07da-9dd3-06497ce826f0@petrovitsch.priv.at> (raw)
In-Reply-To: <b4fdc7c5-8edf-3895-69fc-1bcf9efb5d4a@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6287 bytes --]
Hi all!
On 12/10/2020 18:42, Ujjwal Kumar wrote:
> On 12/10/20 11:50 pm, Lukas Bulwahn wrote:
>>
>>
>> On Mon, 12 Oct 2020, 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 <akpm@linux-foundation.org>
>>> Suggested-by: Kees Cook <keescook@chromium.org>
>>> Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
>>> Signed-off-by: Ujjwal Kumar <ujjwalkumar0501@gmail.com>
>>> ---
>>> 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 0af7945caa61..df20e71dd7c8 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -1256,7 +1256,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
>>> @@ -1312,7 +1312,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 edccdb77c53e..fb07804b7fc1 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 7f96a1a9f68c..617c9ac58156 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 703b1c4f6d12..86d42a2d09cb 100644
>>> --- a/arch/ia64/Makefile
>>> +++ b/arch/ia64/Makefile
>>> @@ -27,8 +27,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)")
>>
>> Here is an instance of what Masahiro-san pointed out being wrong.
>>
>> Ujjwal, will you send a v3?
>
> Following is the quoted text from the reply mail from Masahiro
>
>>> -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)")
>>
>>
>>
>> These changes look wrong to me.
>>
>> $($(CONFIG_SHELL) -> $(shell $(CONFIG_SHELL)
>>
>
> From the above text, I understand as follows:
Did you actually *test* that (expecially) these lines work
afterwards as good as before?
> That my proposed change:
> $(shell $(src...) -> $($(CONFIG_SHELL) $(src...)
>
> is WRONG
Yup, as it's in a Makefile and that's a Makefile construct.
> and in the next line he suggested the required correction.
> That being:
> $($(CONFIG_SHELL) -> $(shell $(CONFIG_SHELL)
Such stuff should generally not be needed as the to-be-used
shell can be set in Makefiles via a "SHELL = " assignment
(defaulting to /bin/sh - what else;-).
Flags for the shell can BTW set with ".SHELLFLAGS = ".
So please
-) learn basic "Makefile" + "make" before brainlessly patching
a Makefile.
-) actually testy your changes to make sure the patch didn't
broke anything
-) and - last but not least - check if there isn't a shell
already set (and which).
MfG,
Bernd
--
There is no cloud, just other people computers.
-- https://static.fsf.org/nosvn/stickers/thereisnocloud.svg
[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 3161 bytes --]
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-10-12 18:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 17:06 [Linux-kernel-mentees] [PATCH v2 0/2] use interpreters to invoke scripts Ujjwal Kumar
2020-10-12 17:06 ` [Linux-kernel-mentees] [PATCH v2 1/2] kconfig: " Ujjwal Kumar
2020-10-13 16:16 ` Masahiro Yamada
2020-10-12 17:06 ` [Linux-kernel-mentees] [PATCH v2 2/2] kbuild: " Ujjwal Kumar
2020-10-12 18:20 ` Lukas Bulwahn
2020-10-12 18:42 ` Ujjwal Kumar
2020-10-12 18:52 ` Lukas Bulwahn
2020-10-12 18:54 ` Bernd Petrovitsch [this message]
2020-10-12 21:48 ` Ujjwal Kumar
2020-10-13 16:02 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53b7257e-b192-07da-9dd3-06497ce826f0@petrovitsch.priv.at \
--to=bernd@petrovitsch.priv.at \
--cc=akpm@linux-foundation.org \
--cc=clang-built-linux@googlegroups.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=ujjwalkumar0501@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).