diff mbox series

[v2] mips: boot/compressed: use __NO_FORTIFY

Message ID 20221031170749.2159430-1-git@johnthomson.fastmail.com.au (mailing list archive)
State Mainlined
Commit 62776e4378ae9086115ffd6f8bd9b9c0fe6e6809
Headers show
Series [v2] mips: boot/compressed: use __NO_FORTIFY | expand

Commit Message

John Thomson Oct. 31, 2022, 5:07 p.m. UTC
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()")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
v2:
fix subject typo: FORITFY->FORTIFY
---
 arch/mips/boot/compressed/decompress.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Bogendoerfer Nov. 11, 2022, 3:05 p.m. UTC | #1
On Tue, Nov 01, 2022 at 03:07:49AM +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()")
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
> v2:
> fix subject typo: FORITFY->FORTIFY
> ---
>  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

applied to mips-fixes.

Thomas.
diff mbox series

Patch

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>