Re: [PATCH] x86/boot: add prototype for __fortify_panic()

From: Kees Cook
Date: Fri May 31 2024 - 16:46:56 EST


On Fri, May 31, 2024 at 09:08:16PM +0200, Borislav Petkov wrote:
> On Fri, May 31, 2024 at 09:53:28AM -0700, Kees Cook wrote:
> > Under CONFIG_FORTIFY_SOURCE, the boot code *does* still uses
> > fortify-string.h. It lets us both catch mistakes we can discover at
> > compile and will catch egregious runtime mistakes, though the reporting
> > is much simpler in the boot code.
>
> From where I'm standing, we're not catching anything in the
> decompressor:
>
> $ objdump -D arch/x86/boot/compressed/vmlinux | grep __fortify_panic
> 0000000001bec250 <__fortify_panic>:
> $
>
> Sure, in vmlinux proper (allmodconfig) we do:
>
> objdump -D vmlinux | grep __fortify_panic | wc -l
> 1417
>
> but not in the decompressor which is special anyway.
>
> So we can just as well disable CONFIG_FORTIFY_SOURCE in the decompressor
> and not do silly prototypes.

Please do not do this. It still benefits from compile-time sanity
checking.

--
Kees Cook