* [PATCH] mips: boot/compressed: use __NO_FORITFY
@ 2022-10-30 18:36 John Thomson
2022-10-31 7:32 ` Kees Cook
2022-10-31 12:15 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: John Thomson @ 2022-10-30 18:36 UTC (permalink / raw)
To: tsbogend, keescook
Cc: linux-mips, linux-hardening, John Thomson, kernel test robot
In the mips CONFIG_SYS_SUPPORTS_ZBOOT kernel, fix the compile error
when using CONFIG_FORTIFY_SOURCE=y
LD vmlinuz
mipsel-openwrt-linux-musl-ld: arch/mips/boot/compressed/decompress.o: in
function `decompress_kernel':
./include/linux/decompress/mm.h:(.text.decompress_kernel+0x177c):
undefined reference to `warn_slowpath_fmt'
kernel test robot helped identify this as related to fortify. The error
appeared with commit 54d9469bc515 ("fortify: Add run-time WARN for
cross-field memcpy()")
Link: https://lore.kernel.org/r/202209161144.x9xSqNQZ-lkp@intel.com/
Resolve this in the same style as commit cfecea6ead5f ("lib/string:
Move helper functions out of string.c")
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 54d9469bc515 ("fortify: Add run-time WARN for cross-field memcpy()")
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
not sure about the fixes tag:
compile error only occurs due to the fortify commit, but it looks like
this change could have been part of the other commit identified in the
message: lib/string move helper functions?
---
arch/mips/boot/compressed/decompress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 5b38a802e101..c5dd415254d3 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -9,6 +9,7 @@
#define DISABLE_BRANCH_PROFILING
+#define __NO_FORTIFY
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mips: boot/compressed: use __NO_FORITFY
2022-10-30 18:36 [PATCH] mips: boot/compressed: use __NO_FORITFY John Thomson
@ 2022-10-31 7:32 ` Kees Cook
2022-10-31 12:15 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-10-31 7:32 UTC (permalink / raw)
To: John Thomson; +Cc: tsbogend, linux-mips, linux-hardening, kernel test robot
On Mon, Oct 31, 2022 at 04:36:47AM +1000, John Thomson wrote:
> In the mips CONFIG_SYS_SUPPORTS_ZBOOT kernel, fix the compile error
> when using CONFIG_FORTIFY_SOURCE=y
>
> LD vmlinuz
> mipsel-openwrt-linux-musl-ld: arch/mips/boot/compressed/decompress.o: in
> function `decompress_kernel':
> ./include/linux/decompress/mm.h:(.text.decompress_kernel+0x177c):
> undefined reference to `warn_slowpath_fmt'
>
> kernel test robot helped identify this as related to fortify. The error
> appeared with commit 54d9469bc515 ("fortify: Add run-time WARN for
> cross-field memcpy()")
> Link: https://lore.kernel.org/r/202209161144.x9xSqNQZ-lkp@intel.com/
>
> Resolve this in the same style as commit cfecea6ead5f ("lib/string:
> Move helper functions out of string.c")
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 54d9469bc515 ("fortify: Add run-time WARN for cross-field memcpy()")
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
> not sure about the fixes tag:
> compile error only occurs due to the fortify commit, but it looks like
> this change could have been part of the other commit identified in the
> message: lib/string move helper functions?
I think the Fixes tag is reasonable. Strictly speaking, it should likely
be whatever added the memcpy() in decompress.c, but that's mostly
nonsense, since nothing else had tripped yet. :)
The issue is that the memcpy() has a runtime length, so
CONFIG_FORTIFY_SOURCE was inserting the logic for a runtime warning,
which doesn't exist here. This is the correct fix (turning off FORTIFY
in the early boot loader).
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mips: boot/compressed: use __NO_FORITFY
2022-10-30 18:36 [PATCH] mips: boot/compressed: use __NO_FORITFY John Thomson
2022-10-31 7:32 ` Kees Cook
@ 2022-10-31 12:15 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-31 12:15 UTC (permalink / raw)
To: John Thomson, tsbogend, keescook
Cc: linux-mips, linux-hardening, kernel test robot
On 30/10/22 19:36, John Thomson wrote:
> In the mips CONFIG_SYS_SUPPORTS_ZBOOT kernel, fix the compile error
> when using CONFIG_FORTIFY_SOURCE=y
>
> LD vmlinuz
> mipsel-openwrt-linux-musl-ld: arch/mips/boot/compressed/decompress.o: in
> function `decompress_kernel':
> ./include/linux/decompress/mm.h:(.text.decompress_kernel+0x177c):
> undefined reference to `warn_slowpath_fmt'
>
> kernel test robot helped identify this as related to fortify. The error
> appeared with commit 54d9469bc515 ("fortify: Add run-time WARN for
> cross-field memcpy()")
> Link: https://lore.kernel.org/r/202209161144.x9xSqNQZ-lkp@intel.com/
>
> Resolve this in the same style as commit cfecea6ead5f ("lib/string:
> Move helper functions out of string.c")
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 54d9469bc515 ("fortify: Add run-time WARN for cross-field memcpy()")
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
> not sure about the fixes tag:
> compile error only occurs due to the fortify commit, but it looks like
> this change could have been part of the other commit identified in the
> message: lib/string move helper functions?
> ---
> arch/mips/boot/compressed/decompress.c | 1 +
> 1 file changed, 1 insertion(+)
Typo "__NO_FORTIFY" in subject.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-31 12:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-30 18:36 [PATCH] mips: boot/compressed: use __NO_FORITFY John Thomson
2022-10-31 7:32 ` Kees Cook
2022-10-31 12:15 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox