Skip to contentSkip to conversation

x86/boot: Remove unused function __fortify_panic()

PATCH Superseded Nikolay Borisov 2 participants 2 messages Jun 10, 2024 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/boot: Remove unused function __fortify_panic()

That functino is only used when the kernel is compiled with FORTIFY_SOURCE and when the kernel proper string.h header is used. The decompressor code doesn't use the kernel proper header but has local copy which doesn't contain any fortified implementations of the various string functions. As such __fortify_panic can never be called from the decompressor so let's remove it.

---
 arch/x86/boot/compressed/misc.c | 5 -----
 1 file changed, 5 deletions(-)
arch/x86/boot/compressed/misc.c +0 -5
index b70e4a21c15f..944454306ef4 100644
@@ -531,8 +531,3 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output)
 
 	return output + entry_offset;
 }
-
-void __fortify_panic(const u8 reason, size_t avail, size_t size)
-{
-	error("detected buffer overflow");
-}
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · Nikolay Borisov

That functino is only used when the kernel is compiled with

       ^^^^^^^^^

Please introduce a spellchecker into your patch creation workflow.

Like, run the thing through the spellchecker on the system or you can even use my python script which checks patches and can do that for you:

https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=vp

Quoted 5 lines

FORTIFY_SOURCE and when the kernel proper string.h header is used. The decompressor code doesn't use the kernel proper header but has local copy which doesn't contain any fortified implementations of the various string functions. As such __fortify_panic can never be called from the decompressor so let's remove it.

Yap, might as well whack it.

We can always resurrect it if it is really needed as it is trivial.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette