From: sashiko-bot@kernel.org
To: "Cao Jin" <pino.cao2022@gmail.com>, nathan@kernel.org, nsc@kernel.org
Cc: linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
Date: Wed, 21 Oct 2026 00:17:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-179629@kernel.org> (raw)
In-Reply-To: <20261020001738.2607318-1-pino.cao2022@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kbuild: unnormalized x86 ARCH variants force 64BIT and break defconfig
--
commit 3a5958b43dbec65a7ac36420afb7bc18b48749a2
Author: Cao Jin <pino.cao2022@gmail.com>
kbuild: improve sanity check for ARCH variable on x86
This commit replaces the explicit i386 and x86_64 checks in the top-level
Makefile with a findstring check matching "86" to set SRCARCH := x86 for
additional x86 architecture name variants such as i486, i586, i686, and
x86_32.
> diff --git a/Makefile b/Makefile
> index 8d23af898d44d..a32e20a8d41dd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -410,12 +410,10 @@ ARCH ?= $(SUBARCH)
> UTS_MACHINE := $(ARCH)
> SRCARCH := $(ARCH)
>
> -# Additional ARCH settings for x86
> -ifeq ($(ARCH),i386)
> - SRCARCH := x86
> -endif
> -ifeq ($(ARCH),x86_64)
> - SRCARCH := x86
> +# Additional sanity check for cmdline ARCH settings for x86. This catch
> +# more name variants than "i386" and "x86_64".
> +ifneq ($(findstring 86,$(ARCH)),)
> + SRCARCH := x86
> endif
[Severity: Medium]
When make is invoked with ARCH=i486, ARCH=i586, ARCH=i686, or ARCH=x86_32,
setting SRCARCH := x86 leaves $(ARCH) unnormalized for downstream x86 build
files.
In arch/x86/Kconfig, the 64BIT symbol checks $(ARCH) directly:
config 64BIT
bool "64-bit kernel" if "$(ARCH)" = "x86"
default "$(ARCH)" != "i386"
Because $(ARCH) is neither "x86" nor "i386" for i486, i586, i686, and
x86_32, the prompt condition evaluates to false and the default expression
evaluates to y. Doesn't this force an unconfigurable 64-bit (CONFIG_64BIT=y,
CONFIG_X86_64=y) build when one of these 32-bit x86 ARCH variants is
requested?
Similarly, arch/x86/Makefile selects KBUILD_DEFCONFIG using $(ARCH):
ifeq ($(ARCH),x86)
ifeq ($(shell uname -m | sed -e 's/i.86/i386/'),i386)
KBUILD_DEFCONFIG := i386_defconfig
else
KBUILD_DEFCONFIG := x86_64_defconfig
endif
else
KBUILD_DEFCONFIG := $(ARCH)_defconfig
endif
Since arch/x86/configs/ only provides i386_defconfig and x86_64_defconfig,
won't running defconfig with ARCH=i486, ARCH=i586, ARCH=i686, or
ARCH=x86_32 still fail trying to find arch/x86/configs/$(ARCH)_defconfig?
>
> # Additional ARCH settings for sparc
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261020001738.2607318-1-pino.cao2022@gmail.com?part=1
prev parent reply other threads:[~2026-10-21 0:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 0:17 [PATCH] kbuild: improve sanity check for ARCH variable on x86 Cao Jin
2026-10-20 0:36 ` Nathan Chancellor
2026-10-20 0:59 ` Borislav Petkov
2026-10-20 1:26 ` Cao Jin
2026-10-20 1:33 ` Cao Jin
2026-10-20 1:39 ` Randy Dunlap
2026-10-20 1:38 ` Randy Dunlap
2026-10-20 1:51 ` Cao Jin
2026-10-21 0:17 ` sashiko-bot [this message]
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=sashiko-outbox-179629@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=pino.cao2022@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.