Skip to contentSkip to conversation

mips: boot/compressed: use __NO_FORTIFY

PATCH Applied John Thomson 2 participants 2 messages Oct 31, 2022 – Nov 11, 2022 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mips: boot/compressed: use __NO_FORTIFY

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()")

Resolve this in the same style as commit cfecea6ead5f ("lib/string:
Move helper functions out of string.c")

Fixes 54d9469bc515 ("fortify: Add run-time WARN for cross-field memcpy()")

---
v2:
fix subject typo: FORITFY->FORTIFY

---
 arch/mips/boot/compressed/decompress.c | 1 +
 1 file changed, 1 insertion(+)
arch/mips/boot/compressed/decompress.c +1 -0
index 5b38a802e101..c5dd415254d3 100644
@@ -9,6 +9,7 @@
 
 #define DISABLE_BRANCH_PROFILING
 
+#define __NO_FORTIFY
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
Signature · 1 line
2.37.2
maintainer Applied
#1 lore raw
Quoted 42 lines · John Thomson

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()")

Resolve this in the same style as commit cfecea6ead5f ("lib/string:
Move helper functions out of string.c")

Fixes 54d9469bc515 ("fortify: Add run-time WARN for cross-field memcpy()")

---
v2:
fix subject typo: FORITFY->FORTIFY

---
 arch/mips/boot/compressed/decompress.c | 1 +
 1 file changed, 1 insertion(+)
arch/mips/boot/compressed/decompress.c +1 -0
index 5b38a802e101..c5dd415254d3 100644
@@ -9,6 +9,7 @@
 
 #define DISABLE_BRANCH_PROFILING
 
+#define __NO_FORTIFY
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
Signature · 1 line
2.37.2

applied to mips-fixes.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]