Commit Graph

6804 Commits

Author SHA1 Message Date
Bruce Ashfield
f0245cc620 This is the 5.15.192 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmjAWuoACgkQONu9yGCS
 aT5ixg/9Ga0oXC7jixh6yJ/Jx6ZXeRpm8421A3SV9B44lCH4gFlxyTwudxBWgqpb
 plo94cdzga2HafZS93r70CUsEXnfG9r1qYZNqSTiDka7R73ifRTREpFHmCfG2TMO
 yEfY6ynmoIoURf9tJqeXIv+EU0y3D/iqK+BXZ+iIsNGAlTPUsCoB3alvYa4iMvSM
 G616TPXytlvqQ1/2ZMlu7U/urFuOMujJLkNgaHZuWDhpcjERP84h133yEUwml8hU
 WmZ29FKvgENC/EPVtgE9Ys9B7KBUUuiHhwsDXrASRAbI5dv8CXFxBPYDMWB9qafT
 TuMQZfEf393xsbOuzuWtDdKfToVKI1/qd+NT6JlfgZ1tPy6R1zmzepvvv5F4BoZe
 +wxHwO01Pc2cmCw8R+khDs5fL8K10IZeeD2At429uJVHhES2TosB5k6RpgB5mwHB
 F6CBzi7DcQLo0LerIB56JZENZqgo0sa2f0Qwr9LyBt4mcHp9h/e3ZU27ZPNO7Uiu
 AUXXAQSxzLLBj5rhtGc6RcFLQAI5m/jNXxyziqqvfMVuwXbneik/7WggIrnTgG8V
 f83KXVDK18WiREhfuat3gDhERwWUSX24SaBQJWnzXh4aQlwuF5rUNkfBGBu2fYCK
 ZPoiYrzmI14XERipmnI9yRw4pixthxWVUimsoqCHYz9oFojECr4=
 =P1Ez
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.192' into v5.15/standard/base

This is the 5.15.192 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmjAWuoACgkQONu9yGCS
# aT5ixg/9Ga0oXC7jixh6yJ/Jx6ZXeRpm8421A3SV9B44lCH4gFlxyTwudxBWgqpb
# plo94cdzga2HafZS93r70CUsEXnfG9r1qYZNqSTiDka7R73ifRTREpFHmCfG2TMO
# yEfY6ynmoIoURf9tJqeXIv+EU0y3D/iqK+BXZ+iIsNGAlTPUsCoB3alvYa4iMvSM
# G616TPXytlvqQ1/2ZMlu7U/urFuOMujJLkNgaHZuWDhpcjERP84h133yEUwml8hU
# WmZ29FKvgENC/EPVtgE9Ys9B7KBUUuiHhwsDXrASRAbI5dv8CXFxBPYDMWB9qafT
# TuMQZfEf393xsbOuzuWtDdKfToVKI1/qd+NT6JlfgZ1tPy6R1zmzepvvv5F4BoZe
# +wxHwO01Pc2cmCw8R+khDs5fL8K10IZeeD2At429uJVHhES2TosB5k6RpgB5mwHB
# F6CBzi7DcQLo0LerIB56JZENZqgo0sa2f0Qwr9LyBt4mcHp9h/e3ZU27ZPNO7Uiu
# AUXXAQSxzLLBj5rhtGc6RcFLQAI5m/jNXxyziqqvfMVuwXbneik/7WggIrnTgG8V
# f83KXVDK18WiREhfuat3gDhERwWUSX24SaBQJWnzXh4aQlwuF5rUNkfBGBu2fYCK
# ZPoiYrzmI14XERipmnI9yRw4pixthxWVUimsoqCHYz9oFojECr4=
# =P1Ez
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 09 Sep 2025 12:50:50 PM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-09-14 23:10:43 -04:00
Kees Cook
8b9a5269b4 randstruct: gcc-plugin: Fix attribute addition
[ Upstream commit f39f18f3c3 ]

Based on changes in the 2021 public version of the randstruct
out-of-tree GCC plugin[1], more carefully update the attributes on
resulting decls, to avoid tripping checks in GCC 15's
comptypes_check_enum_int() when it has been configured with
"--enable-checking=misc":

arch/arm64/kernel/kexec_image.c:132:14: internal compiler error: in comptypes_check_enum_int, at c/c-typeck.cc:1519
  132 | const struct kexec_file_ops kexec_image_ops = {
      |              ^~~~~~~~~~~~~~
 internal_error(char const*, ...), at gcc/gcc/diagnostic-global-context.cc:517
 fancy_abort(char const*, int, char const*), at gcc/gcc/diagnostic.cc:1803
 comptypes_check_enum_int(tree_node*, tree_node*, bool*), at gcc/gcc/c/c-typeck.cc:1519
 ...

Link: https://archive.org/download/grsecurity/grsecurity-3.1-5.10.41-202105280954.patch.gz [1]
Reported-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Closes: https://github.com/KSPP/linux/issues/367
Closes: https://lore.kernel.org/lkml/20250530000646.104457-1-thiago.bauermann@linaro.org/
Reported-by: Ingo Saitz <ingo@hannover.ccc.de>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1104745
Fixes: 313dd1b629 ("gcc-plugins: Add the randstruct plugin")
Tested-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Link: https://lore.kernel.org/r/20250530221824.work.623-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:50:23 +02:00
Kees Cook
db44404d1b randstruct: gcc-plugin: Remove bogus void member
[ Upstream commit e136a40621 ]

When building the randomized replacement tree of struct members, the
randstruct GCC plugin would insert, as the first member, a 0-sized void
member. This appears as though it was done to catch non-designated
("unnamed") static initializers, which wouldn't be stable since they
depend on the original struct layout order.

This was accomplished by having the side-effect of the "void member"
tripping an assert in GCC internals (count_type_elements) if the member
list ever needed to be counted (e.g. for figuring out the order of members
during a non-designated initialization), which would catch impossible type
(void) in the struct:

security/landlock/fs.c: In function ‘hook_file_ioctl_common’:
security/landlock/fs.c:1745:61: internal compiler error: in count_type_elements, at expr.cc:7075
 1745 |                         .u.op = &(struct lsm_ioctlop_audit) {
      |                                                             ^

static HOST_WIDE_INT
count_type_elements (const_tree type, bool for_ctor_p)
{
  switch (TREE_CODE (type))
...
    case VOID_TYPE:
    default:
      gcc_unreachable ();
    }
}

However this is a redundant safety measure since randstruct uses the
__designated_initializer attribute both internally and within the
__randomized_layout attribute macro so that this would be enforced
by the compiler directly even when randstruct was not enabled (via
-Wdesignated-init).

A recent change in Landlock ended up tripping the same member counting
routine when using a full-struct copy initializer as part of an anonymous
initializer. This, however, is a false positive as the initializer is
copying between identical structs (and hence identical layouts). The
"path" member is "struct path", a randomized struct, and is being copied
to from another "struct path", the "f_path" member:

        landlock_log_denial(landlock_cred(file->f_cred), &(struct landlock_request) {
                .type = LANDLOCK_REQUEST_FS_ACCESS,
                .audit = {
                        .type = LSM_AUDIT_DATA_IOCTL_OP,
                        .u.op = &(struct lsm_ioctlop_audit) {
                                .path = file->f_path,
                                .cmd = cmd,
                        },
                },
	...

As can be seen with the coming randstruct KUnit test, there appears to
be no behavioral problems with this kind of initialization when the void
member is removed from the randstruct GCC plugin, so remove it.

Reported-by: "Dr. David Alan Gilbert" <linux@treblig.org>
Closes: https://lore.kernel.org/lkml/Z_PRaKx7q70MKgCA@gallifrey/
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/lkml/20250407-kbuild-disable-gcc-plugins-v1-1-5d46ae583f5e@kernel.org/
Reported-by: WangYuli <wangyuli@uniontech.com>
Closes: https://lore.kernel.org/lkml/337D5D4887277B27+3c677db3-a8b9-47f0-93a4-7809355f1381@uniontech.com/
Fixes: 313dd1b629 ("gcc-plugins: Add the randstruct plugin")
Signed-off-by: Kees Cook <kees@kernel.org>
Stable-dep-of: f39f18f3c3 ("randstruct: gcc-plugin: Fix attribute addition")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:50:23 +02:00
Bruce Ashfield
f70697627b This is the 5.15.190 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmiwZq0ACgkQONu9yGCS
 aT5C2RAApeRwaJN213Dv5b0OnBhpSWeIbFLO06WYGhOzkh/0r3PrEBOHYt/Ix5Kl
 zqngBXbNiekaReRx5Xn2djxT3jgei9d8rtVca1ImM/uC1Imanu7bNoNLeupwIdUu
 i3NhYIGtjWYU22t8AP6xLNEHwVR4SVAwPEadTYZAG3Pwzb93wOJxPQqUOfxRwhyF
 d1bhHKs3Oq+Twes83zy/IrYxwYH95dWjWi+FAZH2g1QPT45RoOZlKfKUXL19J2pC
 7wEvHEY946HbNGQv8DL/eni4M6uQkWl6hdHueLc4bYDPtB8XnU5Us3pKFLJTjbi4
 A2ACwh2tlqZRaUzzHG7lRZKUj6b4Ev55FFPedkJa8QkP6+GWLhtZglwMDf8GB9RS
 hrFZyzUaKDjEPAUX7fhUBs8bw2o8XAG1bDHsiWfpo9LOr8YgrqlKmVeosCi57CIR
 q6Ltdr/T5T2xQ1YZW83oNLTMJVFIv1CXlg+jRkvH2DGUJ5/QGWF64+sgxG0gnJjU
 d0x7ELV8uJzOGserT6jHsOGDvT3EgULM6mA2te8WRJyPYgdFlHMSp++E5WA09hRZ
 qpFTaAofJazIey1rCtg5bFaPjmFWj7WOBvudLmrmcN5N8wXbRWeg2N/F1tYhxN40
 IH1jMIyAX58PvMg+50mfEXpp2G0foeETNTpLhRb5qK3UFGMRNLM=
 =+zfM
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.190' into v5.15/standard/base

This is the 5.15.190 stable release

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmiwZq0ACgkQONu9yGCS
# aT5C2RAApeRwaJN213Dv5b0OnBhpSWeIbFLO06WYGhOzkh/0r3PrEBOHYt/Ix5Kl
# zqngBXbNiekaReRx5Xn2djxT3jgei9d8rtVca1ImM/uC1Imanu7bNoNLeupwIdUu
# i3NhYIGtjWYU22t8AP6xLNEHwVR4SVAwPEadTYZAG3Pwzb93wOJxPQqUOfxRwhyF
# d1bhHKs3Oq+Twes83zy/IrYxwYH95dWjWi+FAZH2g1QPT45RoOZlKfKUXL19J2pC
# 7wEvHEY946HbNGQv8DL/eni4M6uQkWl6hdHueLc4bYDPtB8XnU5Us3pKFLJTjbi4
# A2ACwh2tlqZRaUzzHG7lRZKUj6b4Ev55FFPedkJa8QkP6+GWLhtZglwMDf8GB9RS
# hrFZyzUaKDjEPAUX7fhUBs8bw2o8XAG1bDHsiWfpo9LOr8YgrqlKmVeosCi57CIR
# q6Ltdr/T5T2xQ1YZW83oNLTMJVFIv1CXlg+jRkvH2DGUJ5/QGWF64+sgxG0gnJjU
# d0x7ELV8uJzOGserT6jHsOGDvT3EgULM6mA2te8WRJyPYgdFlHMSp++E5WA09hRZ
# qpFTaAofJazIey1rCtg5bFaPjmFWj7WOBvudLmrmcN5N8wXbRWeg2N/F1tYhxN40
# IH1jMIyAX58PvMg+50mfEXpp2G0foeETNTpLhRb5qK3UFGMRNLM=
# =+zfM
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 28 Aug 2025 10:24:45 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key

# Conflicts:
#	fs/squashfs/super.c
2025-09-03 16:31:47 -04:00
Yann E. MORIN
a12feec53c kconfig: lxdialog: fix 'space' to (de)select options
[ Upstream commit 694174f94e ]

In case a menu has comment without letters/numbers (eg. characters
matching the regexp '^[^[:alpha:][:digit:]]+$', for example - or *),
hitting space will cycle through those comments, rather than
selecting/deselecting the currently-highlighted option.

This is the behaviour of hitting any letter/digit: jump to the next
option which prompt starts with that letter. The only letters that
do not behave as such are 'y' 'm' and 'n'. Prompts that start with
one of those three letters are instead matched on the first letter
that is not 'y', 'm' or 'n'.

Fix that by treating 'space' as we treat y/m/n, ie. as an action key,
not as shortcut to jump to  prompt.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Cherniaev Andrei <dungeonlords789@naver.com>
[masahiro: took from Buildroot, adjusted the commit subject]
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:25 +02:00
Masahiro Yamada
f7d9f0717b kconfig: gconf: fix potential memory leak in renderer_edited()
[ Upstream commit f72ed4c6a3 ]

If gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:25 +02:00
Masahiro Yamada
28498cf306 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
[ Upstream commit cae9cdbcd9 ]

The on_treeview2_cursor_changed() handler is connected to both the left
and right tree views, but it hardcodes model2 (the GtkTreeModel of the
right tree view). This is incorrect. Get the associated model from the
view.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:25 +02:00
Shankari Anand
e008120a62 kconfig: nconf: Ensure null termination where strncpy is used
[ Upstream commit f468992936 ]

strncpy() does not guarantee null-termination if the source string is
longer than the destination buffer.

Ensure the buffer is explicitly null-terminated to prevent potential
string overflows or undefined behavior.

Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Nicolas Schier <n.schier@avm.de>
Acked-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:25 +02:00
Suchit Karunakaran
a73ee10c27 kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c
[ Upstream commit 5ac726653a ]

strcpy() performs no bounds checking and can lead to buffer overflows if
the input string exceeds the destination buffer size. This patch replaces
it with strncpy(), and null terminates the input string.

Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Reviewed-by: Nicolas Schier <nicolas.schier@linux.dev>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:25 +02:00
Masahiro Yamada
06e25dfea3 kconfig: qconf: fix ConfigList::updateListAllforAll()
[ Upstream commit 721bfe583c ]

ConfigList::updateListForAll() and ConfigList::updateListAllforAll()
are identical.

Commit f9b918fae6 ("kconfig: qconf: move ConfigView::updateList(All)
to ConfigList class") was a misconversion.

Fixes: f9b918fae6 ("kconfig: qconf: move ConfigView::updateList(All) to ConfigList class")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:24:12 +02:00
Bruce Ashfield
48702d462c This is the 5.15.186 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmhebPgACgkQONu9yGCS
 aT6WbhAAxw+OnEXNgeJ1VIz8cY2Q1OMTsP3+3SycLtwZlZ4IaSWK/caZENQUmxb2
 i2+RU4U+A8MFeMFQP8TNqOqud5cN4Wjo2cb+oxSB730lzRmmZbUh9V3UQZvUE//z
 u+Kh76lMnDQkP1JxEbScRi0CIFR/kdovtroEN0sPcF2lfzQlKdOoG4dHYYE3tfmZ
 teiRttEGsaHJp4bG+YgMmKrtKa1WW0146An2//g0e8WPcpNbutGA/5TryPCheVNS
 kCfO2DxKHjGFySDeK75yiMHNWJLCuguMaQIhttrlS2fVA6gaspzBOBhrTmucUV7N
 NPMaLfSxnOAQ+5YzGkRyVO43WzbldqHRZBNxtxwgzojVCQ3F5iAhlABE0fpB/ULL
 iwuWNxl7yWNke4cBmFEQZvS52EDU3rYAteGbNFDwE1dGxmDiXD4fD35pTiYYUfiV
 bvX5VXTfamiefZ/cEPgQ0aaHbEKqkEVvK3Xmki7v/MJNqMJpScKMbNRkp9bserU7
 LiAbopyZCsiHC+1O9Xoi91yPXLr6zNN9AusPjpmi6UkHA+Px+nsLKwEqgkW3V73w
 6uQp09jLGigaxFwYAlkbZWY2QhBb6uwU4aFGmPi71Dte4prmI8vUar/D0IzLNzDZ
 +raYZQbcxeB7NJwI1fs7vMQeRBlu4XgwTvMQjtukdhw/X7K47Ok=
 =/8wi
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.186' into v5.15/standard/base

This is the 5.15.186 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmhebPgACgkQONu9yGCS
# aT6WbhAAxw+OnEXNgeJ1VIz8cY2Q1OMTsP3+3SycLtwZlZ4IaSWK/caZENQUmxb2
# i2+RU4U+A8MFeMFQP8TNqOqud5cN4Wjo2cb+oxSB730lzRmmZbUh9V3UQZvUE//z
# u+Kh76lMnDQkP1JxEbScRi0CIFR/kdovtroEN0sPcF2lfzQlKdOoG4dHYYE3tfmZ
# teiRttEGsaHJp4bG+YgMmKrtKa1WW0146An2//g0e8WPcpNbutGA/5TryPCheVNS
# kCfO2DxKHjGFySDeK75yiMHNWJLCuguMaQIhttrlS2fVA6gaspzBOBhrTmucUV7N
# NPMaLfSxnOAQ+5YzGkRyVO43WzbldqHRZBNxtxwgzojVCQ3F5iAhlABE0fpB/ULL
# iwuWNxl7yWNke4cBmFEQZvS52EDU3rYAteGbNFDwE1dGxmDiXD4fD35pTiYYUfiV
# bvX5VXTfamiefZ/cEPgQ0aaHbEKqkEVvK3Xmki7v/MJNqMJpScKMbNRkp9bserU7
# LiAbopyZCsiHC+1O9Xoi91yPXLr6zNN9AusPjpmi6UkHA+Px+nsLKwEqgkW3V73w
# 6uQp09jLGigaxFwYAlkbZWY2QhBb6uwU4aFGmPi71Dte4prmI8vUar/D0IzLNzDZ
# +raYZQbcxeB7NJwI1fs7vMQeRBlu4XgwTvMQjtukdhw/X7K47Ok=
# =/8wi
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 27 Jun 2025 06:05:44 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-07-07 17:04:07 -04:00
Nathan Chancellor
510ce6a139 kbuild: Add KBUILD_CPPFLAGS to as-option invocation
commit 43fc0a9990 upstream.

After commit feb843a469 ("kbuild: add $(CLANG_FLAGS) to
KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
assembly files with clang:

  arch/powerpc/lib/copypage_power7.S: Assembler messages:
  arch/powerpc/lib/copypage_power7.S:34: Error: junk at end of line: `0b01000'
  arch/powerpc/lib/copypage_power7.S:35: Error: junk at end of line: `0b01010'
  arch/powerpc/lib/copypage_power7.S:37: Error: junk at end of line: `0b01000'
  arch/powerpc/lib/copypage_power7.S:38: Error: junk at end of line: `0b01010'
  arch/powerpc/lib/copypage_power7.S:40: Error: junk at end of line: `0b01010'
  clang: error: assembler command failed with exit code 1 (use -v to see invocation)

as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
result of those missing flags, the host target
will be tested during as-option calls and likely fail, meaning necessary
flags may not get added when building assembly files, resulting in
errors like seen above.

Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
This should have been done in commit d5c8d6e0fa ("kbuild: Update
assembler calls to use proper flags and language target"), which
switched from using the assembler target to the assembler-with-cpp
target, so flags that affect preprocessing are passed along in all
relevant tests. as-option now mirrors cc-option.

Fixes: feb843a469 ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:05:21 +01:00
Masahiro Yamada
0690824cc3 kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS
commit feb843a469 upstream.

When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is
not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS.

As a result, the linker script is preprocessed with predefined macros
for the build host instead of the target.

Assuming you use an x86 build machine, compare the following:

 $ clang -dM -E -x c /dev/null
 $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu

There is no actual problem presumably because our linker scripts do not
rely on such predefined macros, but it is better to define correct ones.

Move $(CLANG_FLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S
will be processed with the proper target triple.

[Note]
After the patch submission, we got an actual problem that needs this
commit. (CBL issue 1859)

Link: https://github.com/ClangBuiltLinux/linux/issues/1859
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:05:21 +01:00
Nathan Chancellor
f85d6a08cc kbuild: Add CLANG_FLAGS to as-instr
commit cff6e7f50b upstream.

A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to
KBUILD_CPPFLAGS so that '--target' is available while preprocessing.
When that occurs, the following errors appear multiple times when
building ARCH=powerpc powernv_defconfig:

  ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12d4): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717520 is not in [-2147483648, 2147483647]; references '__start___soft_mask_table'
  ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12e8): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717392 is not in [-2147483648, 2147483647]; references '__stop___soft_mask_table'

Diffing the .o.cmd files reveals that -DHAVE_AS_ATHIGH=1 is not present
anymore, because as-instr only uses KBUILD_AFLAGS, which will no longer
contain '--target'.

Mirror Kconfig's as-instr and add CLANG_FLAGS explicitly to the
invocation to ensure the target information is always present.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:05:21 +01:00
Nick Desaulniers
cefb372db4 kbuild: Update assembler calls to use proper flags and language target
commit d5c8d6e0fa upstream.

as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can
cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
clang will emit -Werror,-Wunused-command-line-argument for various -m
and -f flags in KBUILD_CFLAGS for assembler sources.

Callers of as-option and as-instr should be adding flags to
KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use
KBUILD_AFLAGS in all macros to clear up the initial problem.

Unfortunately, -Wunused-command-line-argument can still be triggered
with clang by the presence of warning flags or macro definitions because
'-x assembler' is used, instead of '-x assembler-with-cpp', which will
consume these flags. Switch to '-x assembler-with-cpp' in places where
'-x assembler' is used, as the compiler is always used as the driver for
out of line assembler sources in the kernel.

Finally, add -Werror to these macros so that they behave consistently
whether or not CONFIG_WERROR is set.

[nathan: Reworded and expanded on problems in commit message
         Use '-x assembler-with-cpp' in a couple more places]

Link: https://github.com/ClangBuiltLinux/linux/issues/1699
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:05:21 +01:00
Bruce Ashfield
118b2e7708 This is the 5.15.185 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmhAPlcACgkQONu9yGCS
 aT6M0w//RJzf9Lwvdobnq/yyl7YlthZQ2FDRIAvLRsJi6HF7kxgNNjLGHeYE31H/
 PhUz+7jzu/Vl47urn/QozINTIG32krGrsiDi+gmF2wDBFmqZSjmsWKEHWNuM3tpl
 R6LkviNoA1AJlCfO30sv9BTmE/97zJGj+c1DJKWcbLOE3ai0KXzS1YbPCzjm3FxY
 6s6H1v4jNzMCNecjyKAdjkAoZQzyLttyjhIV+nTT6pS57Cps79SjFe8YE4yzf9xB
 +8B/zYT8fEvsg0TqNZMwjujrIwyY0Vk2nCKOpZ2siXpDPsBS/5FSLl1FxL2Rxr24
 0qC8vGxa8BivLLsrTg3rfOe3RE96oM2XLfhyzYGlV9qduFjDCfW4yoqcZmLF0eUV
 sq925GCT/Xbyx8AhbCRfUwlDh8iprns6Yx5Jo9XlA7HmZdjN8awCEeocgW7oXI19
 ewzQr54JnLfaGMDRxjxVWBNip9TGwQDddxeAGjUkjlYmigi7gR82+P/0e0wweok2
 ATXxAPc2RuedMyd4U1FIA969q4AVdAbz9mdxAKv4i1I5g8DE6yUtutoDVUylbBgV
 gialH6g0NHgOUm6cuCe9apgEff2DIJ4HD14IYCMmup7vfnwD0YITVPntQYCtM/IX
 HnuA20/LO5NIjXW3JaV0hXjjptFzD3f//Zw9iormHU6LSThLcwM=
 =8ouQ
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.185' into v5.15/standard/base

This is the 5.15.185 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmhAPlcACgkQONu9yGCS
# aT6M0w//RJzf9Lwvdobnq/yyl7YlthZQ2FDRIAvLRsJi6HF7kxgNNjLGHeYE31H/
# PhUz+7jzu/Vl47urn/QozINTIG32krGrsiDi+gmF2wDBFmqZSjmsWKEHWNuM3tpl
# R6LkviNoA1AJlCfO30sv9BTmE/97zJGj+c1DJKWcbLOE3ai0KXzS1YbPCzjm3FxY
# 6s6H1v4jNzMCNecjyKAdjkAoZQzyLttyjhIV+nTT6pS57Cps79SjFe8YE4yzf9xB
# +8B/zYT8fEvsg0TqNZMwjujrIwyY0Vk2nCKOpZ2siXpDPsBS/5FSLl1FxL2Rxr24
# 0qC8vGxa8BivLLsrTg3rfOe3RE96oM2XLfhyzYGlV9qduFjDCfW4yoqcZmLF0eUV
# sq925GCT/Xbyx8AhbCRfUwlDh8iprns6Yx5Jo9XlA7HmZdjN8awCEeocgW7oXI19
# ewzQr54JnLfaGMDRxjxVWBNip9TGwQDddxeAGjUkjlYmigi7gR82+P/0e0wweok2
# ATXxAPc2RuedMyd4U1FIA969q4AVdAbz9mdxAKv4i1I5g8DE6yUtutoDVUylbBgV
# gialH6g0NHgOUm6cuCe9apgEff2DIJ4HD14IYCMmup7vfnwD0YITVPntQYCtM/IX
# HnuA20/LO5NIjXW3JaV0hXjjptFzD3f//Zw9iormHU6LSThLcwM=
# =8ouQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 04 Jun 2025 08:38:47 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-06-06 11:41:44 -04:00
Seyediman Seyedarab
49a99ccec1 kbuild: fix argument parsing in scripts/config
[ Upstream commit f757f6011c ]

The script previously assumed --file was always the first argument,
which caused issues when it appeared later. This patch updates the
parsing logic to scan all arguments to find --file, sets the config
file correctly, and resets the argument list with the remaining
commands.

It also fixes --refresh to respect --file by passing KCONFIG_CONFIG=$FN
to make oldconfig.

Signed-off-by: Seyediman Seyedarab <imandevel@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:37:57 +02:00
Daniel Gomez
f41f9ce3c7 kconfig: merge_config: use an empty file as initfile
[ Upstream commit a26fe287ee ]

The scripts/kconfig/merge_config.sh script requires an existing
$INITFILE (or the $1 argument) as a base file for merging Kconfig
fragments. However, an empty $INITFILE can serve as an initial starting
point, later referenced by the KCONFIG_ALLCONFIG Makefile variable
if -m is not used. This variable can point to any configuration file
containing preset config symbols (the merged output) as stated in
Documentation/kbuild/kconfig.rst. When -m is used $INITFILE will
contain just the merge output requiring the user to run make (i.e.
KCONFIG_ALLCONFIG=<$INITFILE> make <allnoconfig/alldefconfig> or make
olddefconfig).

Instead of failing when `$INITFILE` is missing, create an empty file and
use it as the starting point for merges.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:37:54 +02:00
Bruce Ashfield
d3877a02f0 This is the 5.15.180 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmf3ukwACgkQONu9yGCS
 aT6JUA//QGjcJymP9sGPhvtCKY807MNa5G7zFB4WZ6cRRr5JHYKg63hTvwTM1MoW
 f82V98NfVH0MuUXRayD2ubpHM21jx1bb8EpdMC4n5o0VZNrs2EvlTtuOkGu+1IWn
 yMgq5qdQAjc8uWw9Rmai2REfS3HJszSk6+/CIcEBRxg6UWQ7B19GfVSsUgrnVZA8
 w0KIvA3nd8DLtMcrHS3NjxMV2HPQj0VhO3REkf0tq16qf8Gp6pyxKhVvsrpDTA53
 hoRSPDeYOYM5wj+k6iQcDP7wSCsQiFMGHaLnwXCyzPcepaSCXKgNvOQzMzJRX1qa
 wdR/fhvhr9SC5Ps4a+RD67ghaIqXdCb1YgRYId/BFytFUE+b/Fde4caZ3wBvkwHr
 BcgNI3Lwz08swZYiAuUcEWmR/2FM/j4OLmnD017ZXgJlaiLq9FMWnCbSfJouLbRE
 rmfkXxYM7It+eF3FWaWTZDPXEyuRF1kALdypvVbIE9RDYzSynGgFy7GcFEWnCv5s
 Fc4tdHhbBJc/k8zTURXbTn2kQblmwuMKfehn/E32Zg8PiNyT/lJ/l9GqWwqtaQhP
 RqXU+LzQ/c4alDS2WXb9ldzCseyvbhU56LJp5t8Nfvcmw9db2IfSBpgqmAiwxRpF
 OhyNQgiibkEIHQIRC+JAStdIahXc1aLL+a8WtYCe4GW3faMO9GQ=
 =Aa/c
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.180' into v5.15/standard/base

This is the 5.15.180 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmf3ukwACgkQONu9yGCS
# aT6JUA//QGjcJymP9sGPhvtCKY807MNa5G7zFB4WZ6cRRr5JHYKg63hTvwTM1MoW
# f82V98NfVH0MuUXRayD2ubpHM21jx1bb8EpdMC4n5o0VZNrs2EvlTtuOkGu+1IWn
# yMgq5qdQAjc8uWw9Rmai2REfS3HJszSk6+/CIcEBRxg6UWQ7B19GfVSsUgrnVZA8
# w0KIvA3nd8DLtMcrHS3NjxMV2HPQj0VhO3REkf0tq16qf8Gp6pyxKhVvsrpDTA53
# hoRSPDeYOYM5wj+k6iQcDP7wSCsQiFMGHaLnwXCyzPcepaSCXKgNvOQzMzJRX1qa
# wdR/fhvhr9SC5Ps4a+RD67ghaIqXdCb1YgRYId/BFytFUE+b/Fde4caZ3wBvkwHr
# BcgNI3Lwz08swZYiAuUcEWmR/2FM/j4OLmnD017ZXgJlaiLq9FMWnCbSfJouLbRE
# rmfkXxYM7It+eF3FWaWTZDPXEyuRF1kALdypvVbIE9RDYzSynGgFy7GcFEWnCv5s
# Fc4tdHhbBJc/k8zTURXbTn2kQblmwuMKfehn/E32Zg8PiNyT/lJ/l9GqWwqtaQhP
# RqXU+LzQ/c4alDS2WXb9ldzCseyvbhU56LJp5t8Nfvcmw9db2IfSBpgqmAiwxRpF
# OhyNQgiibkEIHQIRC+JAStdIahXc1aLL+a8WtYCe4GW3faMO9GQ=
# =Aa/c
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 10 Apr 2025 08:32:12 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-04-13 22:55:23 -04:00
Tim Schumacher
ed68a544b9 selinux: Chain up tool resolving errors in install_policy.sh
[ Upstream commit 6ae0042f4d ]

Subshell evaluations are not exempt from errexit, so if a command is
not available, `which` will fail and exit the script as a whole.
This causes the helpful error messages to not be printed if they are
tacked on using a `$?` comparison.

Resolve the issue by using chains of logical operators, which are not
subject to the effects of errexit.

Fixes: e37c1877ba ("scripts/selinux: modernize mdp")
Signed-off-by: Tim Schumacher <tim.schumacher1@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:31:57 +02:00
Bruce Ashfield
e3234082ae This is the 5.15.179 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmfSxr8ACgkQONu9yGCS
 aT4p7A//Xgxx1IkMhky/x0LHPHdKcjvv4gimRd5YxDhXruXE373HSpz9bn8zTnbT
 9N7EQkFMAe4DZzOGWOS1cXrm2isXTJeCLWbeDB3XMI9IkHbY+JVjKzePAENr9mdn
 ILtv3ADRYUeRra1LymVxYFhB9QVAWjzAHepLyrdPvLKOLY9ucGu+MWBYA6tErqp8
 wXXWQTg6Pp3RQW1vrtGfNtx5/SSEkDgZjA0kuiPz+JtnNBAL5IfJ0ze8Rfq98cMl
 QDo5VaT9iir3RNHH8U1yUo3JgF+QUAIiA93r/iETVSg/I4czJJuDdxbQ2cxZMIUm
 uHA4lM2pvENxeLEfuBg/m8eqTlzqcoYguWEihyP0lx+HPE4E6lFJxw3nmhFwSk8D
 2r6anl/cbKA+cTsXeE0VxF1sF1EjW+K7gF/er59Iltjdb9ukTLQzS2Cb0xf5kqeu
 dbHU6Odo2OXlZMGaHp69NP9wAGjEqAn/A2Xr6ZzGhLNCF/jYlG/UBCenyYnwR2O3
 EmgEvY2QS5SPlpyDt4VluDsoqo46QHkmYoKPnpULZQWWI8p8CYCbCfFHj02XOZ4t
 zxs58RW75xXHBO8AUNzs5x9i78HWhY2avjkZHj8RNb2mYLYC0wmhTHHeQ9FnxD0G
 7z6NBb6N9jfutRnbYhMbHOzWTf/8a2d0sNUAAEsEW0E9JqU6PPg=
 =+eEV
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.179' into v5.15/standard/base

This is the 5.15.179 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmfSxr8ACgkQONu9yGCS
# aT4p7A//Xgxx1IkMhky/x0LHPHdKcjvv4gimRd5YxDhXruXE373HSpz9bn8zTnbT
# 9N7EQkFMAe4DZzOGWOS1cXrm2isXTJeCLWbeDB3XMI9IkHbY+JVjKzePAENr9mdn
# ILtv3ADRYUeRra1LymVxYFhB9QVAWjzAHepLyrdPvLKOLY9ucGu+MWBYA6tErqp8
# wXXWQTg6Pp3RQW1vrtGfNtx5/SSEkDgZjA0kuiPz+JtnNBAL5IfJ0ze8Rfq98cMl
# QDo5VaT9iir3RNHH8U1yUo3JgF+QUAIiA93r/iETVSg/I4czJJuDdxbQ2cxZMIUm
# uHA4lM2pvENxeLEfuBg/m8eqTlzqcoYguWEihyP0lx+HPE4E6lFJxw3nmhFwSk8D
# 2r6anl/cbKA+cTsXeE0VxF1sF1EjW+K7gF/er59Iltjdb9ukTLQzS2Cb0xf5kqeu
# dbHU6Odo2OXlZMGaHp69NP9wAGjEqAn/A2Xr6ZzGhLNCF/jYlG/UBCenyYnwR2O3
# EmgEvY2QS5SPlpyDt4VluDsoqo46QHkmYoKPnpULZQWWI8p8CYCbCfFHj02XOZ4t
# zxs58RW75xXHBO8AUNzs5x9i78HWhY2avjkZHj8RNb2mYLYC0wmhTHHeQ9FnxD0G
# 7z6NBb6N9jfutRnbYhMbHOzWTf/8a2d0sNUAAEsEW0E9JqU6PPg=
# =+eEV
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 13 Mar 2025 07:51:27 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-03-19 18:19:48 -04:00
Nathan Chancellor
81a3a0c1a6 kbuild: Move -Wenum-enum-conversion to W=2
commit 8f6629c004 upstream.

-Wenum-enum-conversion was strengthened in clang-19 to warn for C, which
caused the kernel to move it to W=1 in commit 75b5ab134b ("kbuild:
Move -Wenum-{compare-conditional,enum-conversion} into W=1") because
there were numerous instances that would break builds with -Werror.
Unfortunately, this is not a full solution, as more and more developers,
subsystems, and distributors are building with W=1 as well, so they
continue to see the numerous instances of this warning.

Since the move to W=1, there have not been many new instances that have
appeared through various build reports and the ones that have appeared
seem to be following similar existing patterns, suggesting that most
instances of this warning will not be real issues. The only alternatives
for silencing this warning are adding casts (which is generally seen as
an ugly practice) or refactoring the enums to macro defines or a unified
enum (which may be undesirable because of type safety in other parts of
the code).

Move the warning to W=2, where warnings that occur frequently but may be
relevant should reside.

Cc: stable@vger.kernel.org
Fixes: 75b5ab134b ("kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1")
Link: https://lore.kernel.org/ZwRA9SOcOjjLJcpi@google.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-13 12:50:29 +01:00
Masahiro Yamada
4bd72d9fe1 kconfig: fix memory leak in sym_warn_unmet_dep()
[ Upstream commit a409fc1463 ]

The string allocated in sym_warn_unmet_dep() is never freed, leading
to a memory leak when an unmet dependency is detected.

Fixes: f8f69dc0b4 ("kconfig: make unmet dependency warnings readable")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:14 +01:00
Sergey Senozhatsky
5f45a419bd kconfig: WERROR unmet symbol dependency
[ Upstream commit 15d3f7664d ]

When KCONFIG_WERROR env variable is set treat unmet direct
symbol dependency as a terminal condition (error).

Suggested-by: Stefan Reinauer <reinauer@google.com>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:14 +01:00
Masahiro Yamada
ccc1287a02 kconfig: deduplicate code in conf_read_simple()
[ Upstream commit d854b4b21d ]

Kconfig accepts both "# CONFIG_FOO is not set" and "CONFIG_FOO=n" as
a valid input, but conf_read_simple() duplicates similar code to handle
them. Factor out the common code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:14 +01:00
Masahiro Yamada
3e31777acf kconfig: remove unused code for S_DEF_AUTO in conf_read_simple()
[ Upstream commit 92d4fe0a48 ]

The 'else' arm here is unreachable in practical use cases.

include/config/auto.conf does not include "# CONFIG_... is not set"
line unless it is manually hacked.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:14 +01:00
Masahiro Yamada
131f1604fa kconfig: require a space after '#' for valid input
[ Upstream commit 4d137ab010 ]

Currently, when an input line starts with '#', (line + 2) is passed to
memcmp() without checking line[1].

It means that line[1] can be any arbitrary character. For example,
"#KCONFIG_FOO is not set" is accepted as valid input, functioning the
same as "# CONFIG_FOO is not set".

More importantly, this can potentially lead to a buffer overrun if
line[1] == '\0'. It occurs if the input only contains '#', as
(line + 2) points to an uninitialized buffer.

Check line[1], and skip the line if it is not a space.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:13 +01:00
Sergey Senozhatsky
6bdf078908 kconfig: add warn-unknown-symbols sanity check
[ Upstream commit 7cd343008b ]

Introduce KCONFIG_WARN_UNKNOWN_SYMBOLS environment variable,
which makes Kconfig warn about unknown config symbols.

This is especially useful for continuous kernel uprevs when
some symbols can be either removed or renamed between kernel
releases (which can go unnoticed otherwise).

By default KCONFIG_WARN_UNKNOWN_SYMBOLS generates warnings,
which are non-terminal. There is an additional environment
variable KCONFIG_WERROR that overrides this behaviour and
turns warnings into errors.

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:13 +01:00
Masahiro Yamada
4780a614f0 kconfig: fix file name in warnings when loading KCONFIG_DEFCONFIG_LIST
[ Upstream commit a314f52a02 ]

Most 'make *config' commands use .config as the base configuration file.

When .config does not exist, Kconfig tries to load a file listed in
KCONFIG_DEFCONFIG_LIST instead.

However, since commit b75b0a819a ("kconfig: change defconfig_list
option to environment variable"), warning messages have displayed an
incorrect file name in such cases.

Below is a demonstration using Debian Trixie. While loading
/boot/config-6.12.9-amd64, the warning messages incorrectly show .config
as the file name.

With this commit, the correct file name is displayed in warnings.

[Before]

  $ rm -f .config
  $ make config
  #
  # using defaults found in /boot/config-6.12.9-amd64
  #
  .config:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
  .config:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC

[After]

  $ rm -f .config
  $ make config
  #
  # using defaults found in /boot/config-6.12.9-amd64
  #
  /boot/config-6.12.9-amd64:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
  /boot/config-6.12.9-amd64:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC

Fixes: b75b0a819a ("kconfig: change defconfig_list option to environment variable")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:13 +01:00
Masahiro Yamada
c48b8fc7f0 genksyms: fix memory leak when the same symbol is read from *.symref file
[ Upstream commit be2fa44b51 ]

When a symbol that is already registered is read again from *.symref
file, __add_symbol() removes the previous one from the hash table without
freeing it.

[Test Case]

  $ cat foo.c
  #include <linux/export.h>
  void foo(void);
  void foo(void) {}
  EXPORT_SYMBOL(foo);

  $ cat foo.symref
  foo void foo ( void )
  foo void foo ( void )

When a symbol is removed from the hash table, it must be freed along
with its ->name and ->defn members. However, sym->name cannot be freed
because it is sometimes shared with node->string, but not always. If
sym->name and node->string share the same memory, free(sym->name) could
lead to a double-free bug.

To resolve this issue, always assign a strdup'ed string to sym->name.

Fixes: 64e6c1e123 ("genksyms: track symbol checksum changes")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:13 +01:00
Masahiro Yamada
bb28d02726 genksyms: fix memory leak when the same symbol is added from source
[ Upstream commit 45c9c4101d ]

When a symbol that is already registered is added again, __add_symbol()
returns without freeing the symbol definition, making it unreachable.

The following test cases demonstrate different memory leak points.

[Test Case 1]

Forward declaration with exactly the same definition

  $ cat foo.c
  #include <linux/export.h>
  void foo(void);
  void foo(void) {}
  EXPORT_SYMBOL(foo);

[Test Case 2]

Forward declaration with a different definition (e.g. attribute)

  $ cat foo.c
  #include <linux/export.h>
  void foo(void);
  __attribute__((__section__(".ref.text"))) void foo(void) {}
  EXPORT_SYMBOL(foo);

[Test Case 3]

Preserving an overridden symbol (compile with KBUILD_PRESERVE=1)

  $ cat foo.c
  #include <linux/export.h>
  void foo(void);
  void foo(void) { }
  EXPORT_SYMBOL(foo);

  $ cat foo.symref
  override foo void foo ( int )

The memory leaks in Test Case 1 and 2 have existed since the introduction
of genksyms into the kernel tree. [1]

The memory leak in Test Case 3 was introduced by commit 5dae9a550a
("genksyms: allow to ignore symbol checksum changes").

When multiple init_declarators are reduced to an init_declarator_list,
the decl_spec must be duplicated. Otherwise, the following Test Case 4
would result in a double-free bug.

[Test Case 4]

  $ cat foo.c
  #include <linux/export.h>

  extern int foo, bar;

  int foo, bar;
  EXPORT_SYMBOL(foo);

In this case, 'foo' and 'bar' share the same decl_spec, 'int'. It must
be unshared before being passed to add_symbol().

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=46bd1da672d66ccd8a639d3c1f8a166048cca608

Fixes: 5dae9a550a ("genksyms: allow to ignore symbol checksum changes")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-13 12:50:13 +01:00
Bruce Ashfield
fe74df435c This is the 5.15.177 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmeSa0oACgkQONu9yGCS
 aT5/6xAAj24Ahxmspz3HDHhmQAs1ZDt/DLgvMS+6ZE2D4LI/Zn7voMHzjPdRplfO
 iAgaoE0GlVLUJD3ueSKdyG5BM5IS7yj8UQuY7QuBoHUFuF2PdHgM08rK2yBYLh7k
 Aeuj0eC6juy5rx4Ct9rjkGC1uA+nEQrB3CjQXa1bi4DGEjqJw2Oa+pjdYQp9WrML
 ra1Lc+3HTpMyekq+y78/xLnueOmYYYfeaeNk3TqqCPJsg/lnOcMEj2IH0x543RU3
 hD+SEyptSNCtG81/FndbbBu8/xJFCB8ETjkU4XDK0l3iB0J8pWxS85zU0oz7u0z8
 CDIXEHly3YyriLOoGfeBmMSgVULi73Fcbt5ENt6ThGsXrFHkrj6T+e+9qL5+6snW
 c3Lli+vfQfTj5p+yFaKMpTNA44NGDUcYzyT28CbLXcdY81BNWtyh/A7/UbCWxJd4
 apGqhF09/Bl1r1ujAV1KGaMqhuXMaqmcn7rNOt2QrjcJ0xyYAy3aMB4B1WOXLbRp
 RgDL2ulj78BZDFG9wwn0i4goipjf0j5awuzSIR3w+W72MYcfa+arO3vdV7HHsq5a
 CEDxFgkYojSvTzL5/uUYTJImZtfkjnCWrZX3PW5dcMVOyqnOzn6izXsUrXdEr8En
 96VPGR0yHqek1TtRvWP5qszQdodSwIYwWsxvTJStDqUZW5yO50o=
 =6u6d
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.177' into v5.15/standard/base

This is the 5.15.177 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmeSa0oACgkQONu9yGCS
# aT5/6xAAj24Ahxmspz3HDHhmQAs1ZDt/DLgvMS+6ZE2D4LI/Zn7voMHzjPdRplfO
# iAgaoE0GlVLUJD3ueSKdyG5BM5IS7yj8UQuY7QuBoHUFuF2PdHgM08rK2yBYLh7k
# Aeuj0eC6juy5rx4Ct9rjkGC1uA+nEQrB3CjQXa1bi4DGEjqJw2Oa+pjdYQp9WrML
# ra1Lc+3HTpMyekq+y78/xLnueOmYYYfeaeNk3TqqCPJsg/lnOcMEj2IH0x543RU3
# hD+SEyptSNCtG81/FndbbBu8/xJFCB8ETjkU4XDK0l3iB0J8pWxS85zU0oz7u0z8
# CDIXEHly3YyriLOoGfeBmMSgVULi73Fcbt5ENt6ThGsXrFHkrj6T+e+9qL5+6snW
# c3Lli+vfQfTj5p+yFaKMpTNA44NGDUcYzyT28CbLXcdY81BNWtyh/A7/UbCWxJd4
# apGqhF09/Bl1r1ujAV1KGaMqhuXMaqmcn7rNOt2QrjcJ0xyYAy3aMB4B1WOXLbRp
# RgDL2ulj78BZDFG9wwn0i4goipjf0j5awuzSIR3w+W72MYcfa+arO3vdV7HHsq5a
# CEDxFgkYojSvTzL5/uUYTJImZtfkjnCWrZX3PW5dcMVOyqnOzn6izXsUrXdEr8En
# 96VPGR0yHqek1TtRvWP5qszQdodSwIYwWsxvTJStDqUZW5yO50o=
# =6u6d
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 23 Jan 2025 11:16:10 AM EST
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-01-27 11:19:53 -05:00
Kuan-Wei Chiu
3b930badf8 scripts/sorttable: fix orc_sort_cmp() to maintain symmetry and transitivity
commit 0210d25116 upstream.

The orc_sort_cmp() function, used with qsort(), previously violated the
symmetry and transitivity rules required by the C standard.  Specifically,
when both entries are ORC_TYPE_UNDEFINED, it could result in both a < b
and b < a, which breaks the required symmetry and transitivity.  This can
lead to undefined behavior and incorrect sorting results, potentially
causing memory corruption in glibc implementations [1].

Symmetry: If x < y, then y > x.
Transitivity: If x < y and y < z, then x < z.

Fix the comparison logic to return 0 when both entries are
ORC_TYPE_UNDEFINED, ensuring compliance with qsort() requirements.

Link: https://www.qualys.com/2024/01/30/qsort.txt [1]
Link: https://lkml.kernel.org/r/20241226140332.2670689-1-visitorckw@gmail.com
Fixes: 57fa189942 ("scripts/sorttable: Implement build-time ORC unwind table sorting")
Fixes: fb799447ae ("x86,objtool: Split UNWIND_HINT_EMPTY in two")
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw>
Cc: <chuang@cs.nycu.edu.tw>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shile Zhang <shile.zhang@linux.alibaba.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-23 17:15:52 +01:00
Bruce Ashfield
aa5d0061f3 This is the 5.15.176 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmd/wQgACgkQONu9yGCS
 aT6AEw//c3j++tQSEIPiUgOz5i2WAOFvR9/TrpU7AC2XMLvP6jVqq6JCuMp3I5/L
 eY/ZGBWmtvduF+v0n9H9ZYzKhRlpnpRrranqXsxsmnXjpi1IXCthyld9Zm5HhrAC
 nDLctKoGoBc4CS3nSinkZSEXlvLrdtavxlmKaaIx2tZ628jGblFkxKv9uOFcetqT
 UvvRmbg2ar7h27ovEKwpHdoB/M/tr0G2WTjZyWk1yP/Igw5gj22zc4Eb6GsFbnol
 REUKsNcIGkF/vLFwm5lGENnK9COY8+plVQTJIe+X7OtcgPmBcvBUgyQLJjevFDp2
 o0yowSA3SEGiecmYy5jwRHP3EjniVCqrUTQ7pB3HMhySaJLMackgl32olwB4SKi+
 wYzZCcxvYx02nM2ARxReU/gdaltI8gX3qvjS4mT6Ep0ZgynbgPxwmFIe1iv8l6a1
 fOhmlaCMi8qZGTX8y21f4yqkVC+v3ro0P5FeJL0vV+L0PNV4dJmtU+f6ehlh7yi8
 DRljntDPJnGokAuP8fRZTl3zJdfY+p0Cvck5C8Ua3b3cUB0egzag9Jn64FQTq0Bc
 uAGkkrNnEdq2ckd1jxK5vsds5PBwZSgF+xvoFFRY83o9SEU04O1K8uASpSQg6t8b
 OaX4tsxBlUtqU8f4k1VAwGMwGGcpkLyQEscuxWrfj4MwEdUgdP0=
 =OMOj
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.176' into v5.15/standard/base

This is the 5.15.176 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmd/wQgACgkQONu9yGCS
# aT6AEw//c3j++tQSEIPiUgOz5i2WAOFvR9/TrpU7AC2XMLvP6jVqq6JCuMp3I5/L
# eY/ZGBWmtvduF+v0n9H9ZYzKhRlpnpRrranqXsxsmnXjpi1IXCthyld9Zm5HhrAC
# nDLctKoGoBc4CS3nSinkZSEXlvLrdtavxlmKaaIx2tZ628jGblFkxKv9uOFcetqT
# UvvRmbg2ar7h27ovEKwpHdoB/M/tr0G2WTjZyWk1yP/Igw5gj22zc4Eb6GsFbnol
# REUKsNcIGkF/vLFwm5lGENnK9COY8+plVQTJIe+X7OtcgPmBcvBUgyQLJjevFDp2
# o0yowSA3SEGiecmYy5jwRHP3EjniVCqrUTQ7pB3HMhySaJLMackgl32olwB4SKi+
# wYzZCcxvYx02nM2ARxReU/gdaltI8gX3qvjS4mT6Ep0ZgynbgPxwmFIe1iv8l6a1
# fOhmlaCMi8qZGTX8y21f4yqkVC+v3ro0P5FeJL0vV+L0PNV4dJmtU+f6ehlh7yi8
# DRljntDPJnGokAuP8fRZTl3zJdfY+p0Cvck5C8Ua3b3cUB0egzag9Jn64FQTq0Bc
# uAGkkrNnEdq2ckd1jxK5vsds5PBwZSgF+xvoFFRY83o9SEU04O1K8uASpSQg6t8b
# OaX4tsxBlUtqU8f4k1VAwGMwGGcpkLyQEscuxWrfj4MwEdUgdP0=
# =OMOj
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 09 Jan 2025 07:28:56 AM EST
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2025-01-12 23:38:41 -05:00
Masahiro Yamada
362f86f3ee modpost: fix the missed iteration for the max bit in do_input()
[ Upstream commit bf36b4bf1b ]

This loop should iterate over the range from 'min' to 'max' inclusively.
The last interation is missed.

Fixes: 1d8f430c15 ("[PATCH] Input: add modalias support")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-09 13:28:49 +01:00
Masahiro Yamada
3b5efbf000 modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host
[ Upstream commit 77dc55a978 ]

When building a 64-bit kernel on a 32-bit build host, incorrect
input MODULE_ALIAS() entries may be generated.

For example, when compiling a 64-bit kernel with CONFIG_INPUT_MOUSEDEV=m
on a 64-bit build machine, you will get the correct output:

  $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
  MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*r*0,*1,*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*r*a*0,*1,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*r*a*0,*1,*18,*1C,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*r*a*0,*1,*m*l*s*f*w*");

However, building the same kernel on a 32-bit machine results in
incorrect output:

  $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
  MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*130,*r*0,*1,*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*16A,*r*a*0,*1,*20,*21,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*165,*r*a*0,*1,*18,*1C,*20,*21,*38,*3C,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*130,*r*a*0,*1,*20,*21,*m*l*s*f*w*");

A similar issue occurs with CONFIG_INPUT_JOYDEV=m. On a 64-bit build
machine, the output is:

  $ grep MODULE_ALIAS drivers/input/joydev.mod.c
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*120,*r*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*130,*r*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*r*a*m*l*s*f*w*");

However, on a 32-bit machine, the output is incorrect:

  $ grep MODULE_ALIAS drivers/input/joydev.mod.c
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*22,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
  MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*2E0,*r*a*m*l*s*f*w*");

When building a 64-bit kernel, BITS_PER_LONG is defined as 64. However,
on a 32-bit build machine, the constant 1L is a signed 32-bit value.
Left-shifting it beyond 32 bits causes wraparound, and shifting by 31
or 63 bits makes it a negative value.

The fix in commit e0e9263271 ("[PATCH] PATCH: 1 line 2.6.18 bugfix:
modpost-64bit-fix.patch") is incorrect; it only addresses cases where
a 64-bit kernel is built on a 64-bit build machine, overlooking cases
on a 32-bit build machine.

Using 1ULL ensures a 64-bit width on both 32-bit and 64-bit machines,
avoiding the wraparound issue.

Fixes: e0e9263271 ("[PATCH] PATCH: 1 line 2.6.18 bugfix: modpost-64bit-fix.patch")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: bf36b4bf1b ("modpost: fix the missed iteration for the max bit in do_input()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-09 13:28:49 +01:00
Bruce Ashfield
a340a82f59 This is the 5.15.174 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmdd08kACgkQONu9yGCS
 aT56CRAA1hlj0FjEaTXhuPDg5BpCi9srcxKsqUHQ3FIucBEZvpSyfD3eoXJf4irA
 8ckSHB13FvmNU9W8bVq9xzy4+xaYGawouIdGiWBmFETZeSkqesqNUOCqQEUMtkDO
 ImsZnFYV54ek8edl9bLgQpLvnHoRyvsJVadtuaTWfsQbhAOUSnfMJId61SxF8PPn
 ZrCW0AtswnC/Jzx8IcRz54R75/xXNWAk6sJUmXkwL6QDdaVa3BZ36MZa8EqRP1YJ
 4TjYf3D5V+1XmHhADx1Re5pJs50mPd5MADNZc3IN/5TkvUDBxgPcJBGPyt1F4fvm
 m472mCVsUsxAZgfAz60jqmOCUsh0onhAuOOh0zoU3MYxxZDGKpM0dTYJmQ/dvi4E
 5uMzmsqpDN4PYKTjJetUEVXWt77H3onRJx1CYFZjVlmKcxsidds7ipjV4QCnKC2L
 3mhxTgsWbWq2CwrAaPLM/NvuId/AZHQV6UxIwO7HPrz215iZESmI+0NmIWKIsGNG
 ANFc7YmB+xYdSfFIN/2Q9R9PzO6NwQqqy7uCgCAeWfD0+oVEZrVXuKNpYSmPS8mn
 PJBt6byxbBXQ4X4RBieF64fa6OWwaRd1n/1gRCDJTa2RHRpd3zJqfDdIa9o94Vo6
 LEmSS34tZrLXNhn+K29zVhT0zQATdjVX/f6XgdGl63Zqiufq3N8=
 =nCTo
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.174' into v5.15/standard/base

This is the 5.15.174 stable release

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmdd08kACgkQONu9yGCS
# aT56CRAA1hlj0FjEaTXhuPDg5BpCi9srcxKsqUHQ3FIucBEZvpSyfD3eoXJf4irA
# 8ckSHB13FvmNU9W8bVq9xzy4+xaYGawouIdGiWBmFETZeSkqesqNUOCqQEUMtkDO
# ImsZnFYV54ek8edl9bLgQpLvnHoRyvsJVadtuaTWfsQbhAOUSnfMJId61SxF8PPn
# ZrCW0AtswnC/Jzx8IcRz54R75/xXNWAk6sJUmXkwL6QDdaVa3BZ36MZa8EqRP1YJ
# 4TjYf3D5V+1XmHhADx1Re5pJs50mPd5MADNZc3IN/5TkvUDBxgPcJBGPyt1F4fvm
# m472mCVsUsxAZgfAz60jqmOCUsh0onhAuOOh0zoU3MYxxZDGKpM0dTYJmQ/dvi4E
# 5uMzmsqpDN4PYKTjJetUEVXWt77H3onRJx1CYFZjVlmKcxsidds7ipjV4QCnKC2L
# 3mhxTgsWbWq2CwrAaPLM/NvuId/AZHQV6UxIwO7HPrz215iZESmI+0NmIWKIsGNG
# ANFc7YmB+xYdSfFIN/2Q9R9PzO6NwQqqy7uCgCAeWfD0+oVEZrVXuKNpYSmPS8mn
# PJBt6byxbBXQ4X4RBieF64fa6OWwaRd1n/1gRCDJTa2RHRpd3zJqfDdIa9o94Vo6
# LEmSS34tZrLXNhn+K29zVhT0zQATdjVX/f6XgdGl63Zqiufq3N8=
# =nCTo
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 14 Dec 2024 01:51:53 PM EST
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key

# Conflicts:
#	mm/mmap.c
2024-12-17 09:32:35 -05:00
Thomas Gleixner
7ff5af6bdb modpost: Add .irqentry.text to OTHER_SECTIONS
[ Upstream commit 7912405643 ]

The compiler can fully inline the actual handler function of an interrupt
entry into the .irqentry.text entry point. If such a function contains an
access which has an exception table entry, modpost complains about a
section mismatch:

  WARNING: vmlinux.o(__ex_table+0x447c): Section mismatch in reference ...

  The relocation at __ex_table+0x447c references section ".irqentry.text"
  which is not in the list of authorized sections.

Add .irqentry.text to OTHER_SECTIONS to cure the issue.

Reported-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org # needed for linux-5.4-y
Link: https://lore.kernel.org/all/20241128111844.GE10431@google.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 19:51:43 +01:00
Nathan Chancellor
973cfc7ea3 modpost: Include '.text.*' in TEXT_SECTIONS
[ Upstream commit 19331e84c3 ]

Commit 6c730bfc89 ("modpost: handle -ffunction-sections") added
".text.*" to the OTHER_TEXT_SECTIONS macro to fix certain section
mismatch warnings. Unfortunately, this makes it impossible for modpost
to warn about section mismatches with LTO, which implies
'-ffunction-sections', as all functions are put in their own
'.text.<func_name>' sections, which may still reference functions in
sections they are not supposed to, such as __init.

Fix this by moving ".text.*" into TEXT_SECTIONS, so that configurations
with '-ffunction-sections' will see warnings about mismatched sections.

Link: https://lore.kernel.org/Y39kI3MOtVI5BAnV@google.com/
Reported-by: Vincent Donnefort <vdonnefort@google.com>
Reviewed-and-tested-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: 7912405643 ("modpost: Add .irqentry.text to OTHER_SECTIONS")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 19:51:43 +01:00
Masahiro Yamada
14d02aec58 modpost: remove incorrect code in do_eisa_entry()
[ Upstream commit 0c3e091319 ]

This function contains multiple bugs after the following commits:

 - ac55182899 ("modpost: i2c aliases need no trailing wildcard")
 - 6543becf26 ("mod/file2alias: make modalias generation safe for cross compiling")

Commit ac55182899 inserted the following code to do_eisa_entry():

    else
            strcat(alias, "*");

This is incorrect because 'alias' is uninitialized. If it is not
NULL-terminated, strcat() could cause a buffer overrun.

Even if 'alias' happens to be zero-filled, it would output:

    MODULE_ALIAS("*");

This would match anything. As a result, the module could be loaded by
any unrelated uevent from an unrelated subsystem.

Commit ac55182899 introduced another bug.            

Prior to that commit, the conditional check was:

    if (eisa->sig[0])

This checked if the first character of eisa_device_id::sig was not '\0'.

However, commit ac55182899 changed it as follows:

    if (sig[0])

sig[0] is NOT the first character of the eisa_device_id::sig. The
type of 'sig' is 'char (*)[8]', meaning that the type of 'sig[0]' is
'char [8]' instead of 'char'. 'sig[0]' and 'symval' refer to the same
address, which never becomes NULL.

The correct conversion would have been:

    if ((*sig)[0])

However, this if-conditional was meaningless because the earlier change
in commit ac551828993e was incorrect.

This commit removes the entire incorrect code, which should never have
been executed.

Fixes: ac55182899 ("modpost: i2c aliases need no trailing wildcard")
Fixes: 6543becf26 ("mod/file2alias: make modalias generation safe for cross compiling")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 19:51:21 +01:00
Bruce Ashfield
d918322631 This is the 5.15.168 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmcRDSsACgkQONu9yGCS
 aT4Zcw/+LikQ9xtlMNepXFwlvYjAOzOPcBxcnukeVVPymqKdiv5dCTGBi6ydZ89q
 NtKKQRf1nnXcppWOOIXBXjKIGfBET2z3oQIi0IC4yQ2j9y+ZD7sV5CIxLEaCfO61
 QEru9gDh/SmH5y/44pdYZGCCLKyS/tNl4aVDNHceyPpr9S8yTAcUgH3N4u073iLE
 QNSxuo8xGRP/vFNSFVJmEc5kdY3Lg1Lvi+WGn7/YMBtGMGDNSctG2Lja4rk/weDR
 IRgR+41nBGmnLf2f4rw+xeYXCDYZddckWteFpaIoIT0vmYq1dCmjFH9Y4amM2KmH
 xj0uxz1LcwMXQksZUnCTd9mH/mjxyqhlbsSxsJMEHUPAeAgzztgRhUVMqmadDxGR
 dWLIm3eieH+CbvmGdm/QgJN8PFi5iQU677UnDsCKCr2iRvB5Lp76ncs+R+I8c868
 DfX0X18Zv4H2qs3KbQ36SwJbzN4KYqyvt3sIyzKuTmf8WFFJaoRbkbTHedwFIq6w
 +YZPPrE+BiwVE4hbh6vY7tASZe2MicuJajyBA5fxhueo+bIaae7i6FSZ+ZB3ecd+
 wg2w/jTWBCpOkbcH3x1nZqgaiPT15C+6FmX7z6I0RZaiJbEOmJRVdoGP44/6XXh3
 zJqi6jvAqeme93L5u6hzkAR/uf6ABzdtiLIJ5k4CtKdjXMfVma0=
 =Fr5K
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.168' into v5.15/standard/base

This is the 5.15.168 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmcRDSsACgkQONu9yGCS
# aT4Zcw/+LikQ9xtlMNepXFwlvYjAOzOPcBxcnukeVVPymqKdiv5dCTGBi6ydZ89q
# NtKKQRf1nnXcppWOOIXBXjKIGfBET2z3oQIi0IC4yQ2j9y+ZD7sV5CIxLEaCfO61
# QEru9gDh/SmH5y/44pdYZGCCLKyS/tNl4aVDNHceyPpr9S8yTAcUgH3N4u073iLE
# QNSxuo8xGRP/vFNSFVJmEc5kdY3Lg1Lvi+WGn7/YMBtGMGDNSctG2Lja4rk/weDR
# IRgR+41nBGmnLf2f4rw+xeYXCDYZddckWteFpaIoIT0vmYq1dCmjFH9Y4amM2KmH
# xj0uxz1LcwMXQksZUnCTd9mH/mjxyqhlbsSxsJMEHUPAeAgzztgRhUVMqmadDxGR
# dWLIm3eieH+CbvmGdm/QgJN8PFi5iQU677UnDsCKCr2iRvB5Lp76ncs+R+I8c868
# DfX0X18Zv4H2qs3KbQ36SwJbzN4KYqyvt3sIyzKuTmf8WFFJaoRbkbTHedwFIq6w
# +YZPPrE+BiwVE4hbh6vY7tASZe2MicuJajyBA5fxhueo+bIaae7i6FSZ+ZB3ecd+
# wg2w/jTWBCpOkbcH3x1nZqgaiPT15C+6FmX7z6I0RZaiJbEOmJRVdoGP44/6XXh3
# zJqi6jvAqeme93L5u6hzkAR/uf6ABzdtiLIJ5k4CtKdjXMfVma0=
# =Fr5K
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 17 Oct 2024 09:12:11 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2024-10-21 08:29:55 -04:00
Masahiro Yamada
3d5bce8a9f kconfig: qconf: fix buffer overflow in debug links
[ Upstream commit 984ed20ece ]

If you enable "Option -> Show Debug Info" and click a link, the program
terminates with the following error:

    *** buffer overflow detected ***: terminated

The buffer overflow is caused by the following line:

    strcat(data, "$");

The buffer needs one more byte to accommodate the additional character.

Fixes: c4f7398bee ("kconfig: qconf: make debug links work again")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-17 15:11:43 +02:00
Anders Roxell
18576c701e scripts: kconfig: merge_config: config files: add a trailing newline
[ Upstream commit 33330bcf03 ]

When merging files without trailing newlines at the end of the file, two
config fragments end up at the same row if file1.config doens't have a
trailing newline at the end of the file.

file1.config "CONFIG_1=y"
file2.config "CONFIG_2=y"
./scripts/kconfig/merge_config.sh -m .config file1.config file2.config

This will generate a .config looking like this.
cat .config
...
CONFIG_1=yCONFIG_2=y"

Making sure so we add a newline at the end of every config file that is
passed into the script.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-10-17 15:10:33 +02:00
Bruce Ashfield
14993927ac This is the 5.15.165 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbCwuQACgkQONu9yGCS
 aT7gqBAAptNwkZ64vzbfRa/C9PJx3tC+EBPeq/flGOODZhXltw5U/oXrKivcGjRe
 3+ZFAqSge/5vbCCjWxkEZvMh3e8I67Yk3fo1WmZbXwQdlOkyA8Wg+Fyfypk35834
 /rRsKaXnFAF0meBGUMZAzG6H/7OvjakrrAabtPNX2JxZAZ2KQXkcVwcp/h1Enn3j
 Ov/eiTYrNybsaRfNkPk/1KyanbF9ByZebkyXcEv7RD2Z+X4S+6BgW1kc7/usDyT+
 7x02TSwYCzO4v5rr8pEzTwPtN94O3+fggSHKsKx/jLySg9+j0UrrFU1kReKoIbUG
 a+EnRyTrv0SHjnrmBpfAgvMKPy+F3ktd610jlBudrqViXDM9vUqVpuUI/rZ23jM0
 hRZqaf5pQk+Y/xr27ymL1u9wz7KabwTjFrc10uRe82g7Zj4ZsKw20Vz5Xp7KAInn
 LIRvYS2A8LQoV6k4Xal5DUu6K15tL98HUKM9auo6tOQySBwJBYFtnQ1hDFo3D5Gl
 dZzgxKzy4VvdPlInGKR3GjRsPIQnrFQZ2RxOD9qoxYt1N3jHphenkP4T4UXmhpFF
 6YVpWuW9Ii02tUwdPajAvOOhUWy0Dt9rv0DTIgHD6q+xqt1GOMsRNihD5uAI7Lic
 YavuUekwav2iZrgmbsOFEIWSCFKrxdymGnjUB+dxqqjffVMWY7k=
 =jQI8
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.165' into v5.15/standard/base

This is the 5.15.165 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbCwuQACgkQONu9yGCS
# aT7gqBAAptNwkZ64vzbfRa/C9PJx3tC+EBPeq/flGOODZhXltw5U/oXrKivcGjRe
# 3+ZFAqSge/5vbCCjWxkEZvMh3e8I67Yk3fo1WmZbXwQdlOkyA8Wg+Fyfypk35834
# /rRsKaXnFAF0meBGUMZAzG6H/7OvjakrrAabtPNX2JxZAZ2KQXkcVwcp/h1Enn3j
# Ov/eiTYrNybsaRfNkPk/1KyanbF9ByZebkyXcEv7RD2Z+X4S+6BgW1kc7/usDyT+
# 7x02TSwYCzO4v5rr8pEzTwPtN94O3+fggSHKsKx/jLySg9+j0UrrFU1kReKoIbUG
# a+EnRyTrv0SHjnrmBpfAgvMKPy+F3ktd610jlBudrqViXDM9vUqVpuUI/rZ23jM0
# hRZqaf5pQk+Y/xr27ymL1u9wz7KabwTjFrc10uRe82g7Zj4ZsKw20Vz5Xp7KAInn
# LIRvYS2A8LQoV6k4Xal5DUu6K15tL98HUKM9auo6tOQySBwJBYFtnQ1hDFo3D5Gl
# dZzgxKzy4VvdPlInGKR3GjRsPIQnrFQZ2RxOD9qoxYt1N3jHphenkP4T4UXmhpFF
# 6YVpWuW9Ii02tUwdPajAvOOhUWy0Dt9rv0DTIgHD6q+xqt1GOMsRNihD5uAI7Lic
# YavuUekwav2iZrgmbsOFEIWSCFKrxdymGnjUB+dxqqjffVMWY7k=
# =jQI8
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 18 Aug 2024 11:58:28 PM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2024-08-20 11:28:41 -04:00
Nathan Chancellor
84bb2f0c98 kbuild: Fix '-S -c' in x86 stack protector scripts
commit 3415b10a03 upstream.

After a recent change in clang to stop consuming all instances of '-S'
and '-c' [1], the stack protector scripts break due to the kernel's use
of -Werror=unused-command-line-argument to catch cases where flags are
not being properly consumed by the compiler driver:

  $ echo | clang -o - -x c - -S -c -Werror=unused-command-line-argument
  clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]

This results in CONFIG_STACKPROTECTOR getting disabled because
CONFIG_CC_HAS_SANE_STACKPROTECTOR is no longer set.

'-c' and '-S' both instruct the compiler to stop at different stages of
the pipeline ('-S' after compiling, '-c' after assembling), so having
them present together in the same command makes little sense. In this
case, the test wants to stop before assembling because it is looking at
the textual assembly output of the compiler for either '%fs' or '%gs',
so remove '-c' from the list of arguments to resolve the error.

All versions of GCC continue to work after this change, along with
versions of clang that do or do not contain the change mentioned above.

Cc: stable@vger.kernel.org
Fixes: 4f7fd4d7a7 ("[PATCH] Add the -fstack-protector option to the CFLAGS")
Fixes: 60a5317ff0 ("x86: implement x86_32 stack protector")
Link: 6461e53781 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-19 05:45:16 +02:00
Bruce Ashfield
62668d7a15 This is the 5.15.164 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmaks94ACgkQONu9yGCS
 aT6v3w/9HiPUIOk8GPTDHKvsFRpJf0QmZSabgBgj0HYFmXn/cdxYSUQJ8oq3ATu6
 lYKZ3uf8jBUrR9OFDRLfP0vCSIV3yqdFBs97YMwd6g1zRBBoe2AX/C+5hN/F7/I0
 JJ5tB/+jHdAU73pQD+nvNo4gHkUXBzJXuXzAqhlyRSoLNeHcnpmu1BIVtbaVWc31
 2viIZG0bL8thgAa68VsCHfIWXNGFuj2qe525fmKZcoaEUSgpVXHAR2AsCpHKRa2s
 3/fIUNoFuNNYbFMqWa5OHArsUdCnPBLBC4tarYq8jVd8fGI0F8jjZAjCQBcXxErK
 rhagBby7ZOMSoHFWGMiZ2XJNBTgTVyBBVM0E2XH2I+VPrl7htIXUBmzuiQabuwDS
 WnerqbOYbIlimEHAG7uFW1ht4G8DtKP0NIpjEzM9j/p9oBnDX3ohF63AC8ZqbwNW
 eDoDsPrr6iWo7OpNtd0SOBStXEkvClmitMfXh4W6jDuQSNmWqKZIYm0OXKjS7mjN
 EmeGVHxHHQhnshj7Bw+uhkHLgg3RLkXpyD2pDit8zx7QZFLvhC+dcg7VJ9JEKyDK
 qU97rm1dSpbXVukU/eAb0HhTx10MlojxcmgUnwEuMSaDrxk+JRKY0OV957oManVP
 3vf8DQzZ2VWsWqu48sTeNbcT2YrRgpxC/zHxxK8Hknh9lgj/79Y=
 =vjHT
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.164' into v5.15/standard/base

This is the 5.15.164 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmaks94ACgkQONu9yGCS
# aT6v3w/9HiPUIOk8GPTDHKvsFRpJf0QmZSabgBgj0HYFmXn/cdxYSUQJ8oq3ATu6
# lYKZ3uf8jBUrR9OFDRLfP0vCSIV3yqdFBs97YMwd6g1zRBBoe2AX/C+5hN/F7/I0
# JJ5tB/+jHdAU73pQD+nvNo4gHkUXBzJXuXzAqhlyRSoLNeHcnpmu1BIVtbaVWc31
# 2viIZG0bL8thgAa68VsCHfIWXNGFuj2qe525fmKZcoaEUSgpVXHAR2AsCpHKRa2s
# 3/fIUNoFuNNYbFMqWa5OHArsUdCnPBLBC4tarYq8jVd8fGI0F8jjZAjCQBcXxErK
# rhagBby7ZOMSoHFWGMiZ2XJNBTgTVyBBVM0E2XH2I+VPrl7htIXUBmzuiQabuwDS
# WnerqbOYbIlimEHAG7uFW1ht4G8DtKP0NIpjEzM9j/p9oBnDX3ohF63AC8ZqbwNW
# eDoDsPrr6iWo7OpNtd0SOBStXEkvClmitMfXh4W6jDuQSNmWqKZIYm0OXKjS7mjN
# EmeGVHxHHQhnshj7Bw+uhkHLgg3RLkXpyD2pDit8zx7QZFLvhC+dcg7VJ9JEKyDK
# qU97rm1dSpbXVukU/eAb0HhTx10MlojxcmgUnwEuMSaDrxk+JRKY0OV957oManVP
# 3vf8DQzZ2VWsWqu48sTeNbcT2YrRgpxC/zHxxK8Hknh9lgj/79Y=
# =vjHT
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 27 Jul 2024 04:46:22 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2024-07-28 16:49:10 -04:00
Bruce Ashfield
e36f04be2a This is the 5.15.163 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmaY9+UACgkQONu9yGCS
 aT73CxAA0wSgA+saIGjkv944jagUBJ4VPQU13j4aCqWRSXDc8oQckC+a/kWlTut8
 niTcxVabjeVUnrGlganzgwrl79dHEan/9JRglXCJuVsjH4LSDaK4aC9aVT8Ldyb6
 wFh3uYEMpmkbUYYeKLfFcHSPdaplMd2baVhuOqmnmb822rOVgKeaMpkjs2EAUNIn
 /CAiLV6ESMC3fcobhBMJI/zaS/0Vm0Fhju0LYQq9q/DPd82DTYABUju64nbtpc/b
 XeNSeTxB1Qqf02Mx90h+AsvDIeU+jsHNZQO/sTRaBgQpbnpzUmoP+qQzqGP4PrGK
 oxIIq/TbY7MmjmJ/j+T/8LtZWP+RpG9nXzrzer+XjmhoH3tHQRu9P9HlM/tyR9Fk
 M+MZHeuce8e6FZ/Kl7FxBrsyrl0d3dkZn9SHi5sIkiHRAc8I0lljntKN2o9iNzCg
 6WFWP0gM+BDpQp33xy77e+xNNSVDETJszfsSRIjuY61U4f9AVrIpe/1KWdKKiBjO
 h/CsaDaP3N6epbJHrZbKrvtq4mpDOnlq/9KOusjOo6kSNrjWCOe+OTvKpOMkmbhU
 IWZoRa3LQ0izCsVL1REmokGuDKmL/2q/kERwrjl3Y1JlEiDQXOaYFWGv6nwggWyE
 yt5X8L8wzUJfD4DJI1R8iE3gTu9/GnGJLFUQqvYcbmluZhsd9sc=
 =OFVV
 -----END PGP SIGNATURE-----

Merge tag 'v5.15.163' into v5.15/standard/base

This is the 5.15.163 stable release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmaY9+UACgkQONu9yGCS
# aT73CxAA0wSgA+saIGjkv944jagUBJ4VPQU13j4aCqWRSXDc8oQckC+a/kWlTut8
# niTcxVabjeVUnrGlganzgwrl79dHEan/9JRglXCJuVsjH4LSDaK4aC9aVT8Ldyb6
# wFh3uYEMpmkbUYYeKLfFcHSPdaplMd2baVhuOqmnmb822rOVgKeaMpkjs2EAUNIn
# /CAiLV6ESMC3fcobhBMJI/zaS/0Vm0Fhju0LYQq9q/DPd82DTYABUju64nbtpc/b
# XeNSeTxB1Qqf02Mx90h+AsvDIeU+jsHNZQO/sTRaBgQpbnpzUmoP+qQzqGP4PrGK
# oxIIq/TbY7MmjmJ/j+T/8LtZWP+RpG9nXzrzer+XjmhoH3tHQRu9P9HlM/tyR9Fk
# M+MZHeuce8e6FZ/Kl7FxBrsyrl0d3dkZn9SHi5sIkiHRAc8I0lljntKN2o9iNzCg
# 6WFWP0gM+BDpQp33xy77e+xNNSVDETJszfsSRIjuY61U4f9AVrIpe/1KWdKKiBjO
# h/CsaDaP3N6epbJHrZbKrvtq4mpDOnlq/9KOusjOo6kSNrjWCOe+OTvKpOMkmbhU
# IWZoRa3LQ0izCsVL1REmokGuDKmL/2q/kERwrjl3Y1JlEiDQXOaYFWGv6nwggWyE
# yt5X8L8wzUJfD4DJI1R8iE3gTu9/GnGJLFUQqvYcbmluZhsd9sc=
# =OFVV
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 Jul 2024 07:09:25 AM EDT
# gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
# gpg: Can't check signature: No public key
2024-07-28 16:47:02 -04:00
Masahiro Yamada
da0fec30a7 kconfig: remove wrong expr_trans_bool()
[ Upstream commit 77a92660d8 ]

expr_trans_bool() performs an incorrect transformation.

[Test Code]

    config MODULES
            def_bool y
            modules

    config A
            def_bool y
            select C if B != n

    config B
            def_tristate m

    config C
            tristate

[Result]

    CONFIG_MODULES=y
    CONFIG_A=y
    CONFIG_B=m
    CONFIG_C=m

This output is incorrect because CONFIG_C=y is expected.

Documentation/kbuild/kconfig-language.rst clearly explains the function
of the '!=' operator:

    If the values of both symbols are equal, it returns 'n',
    otherwise 'y'.

Therefore, the statement:

    select C if B != n

should be equivalent to:

    select C if y

Or, more simply:

    select C

Hence, the symbol C should be selected by the value of A, which is 'y'.

However, expr_trans_bool() wrongly transforms it to:

    select C if B

Therefore, the symbol C is selected by (A && B), which is 'm'.

The comment block of expr_trans_bool() correctly explains its intention:

  * bool FOO!=n => FOO
    ^^^^

If FOO is bool, FOO!=n can be simplified into FOO. This is correct.

However, the actual code performs this transformation when FOO is
tristate:

    if (e->left.sym->type == S_TRISTATE) {
                             ^^^^^^^^^^

While it can be fixed to S_BOOLEAN, there is no point in doing so
because expr_tranform() already transforms FOO!=n to FOO when FOO is
bool. (see the "case E_UNEQUAL" part)

expr_trans_bool() is wrong and unnecessary.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:46:09 +02:00
Masahiro Yamada
f6ea77184d kconfig: gconf: give a proper initial state to the Save button
[ Upstream commit 46edf4372e ]

Currently, the initial state of the "Save" button is always active.

If none of the CONFIG options are changed while loading the .config
file, the "Save" button should be greyed out.

This can be fixed by calling conf_read() after widget initialization.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-27 10:46:09 +02:00
Kees Cook
05bbd8d1e9 gcc-plugins: Rename last_stmt() for GCC 14+
commit 2e3f65ccfe upstream.

In GCC 14, last_stmt() was renamed to last_nondebug_stmt(). Add a helper
macro to handle the renaming.

Cc: linux-hardening@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-27 10:46:06 +02:00