Re: [PATCH 10/11] x86/purgatory: Compile purgatory.c with -D__NO_FORTIFY

From: Borislav Petkov

Date: Fri Aug 14 2026 - 11:25:58 EST


On Thu, Aug 13, 2026 at 03:49:48PM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@xxxxxxxxxx>
>
> purgatory.c includes both, the <crypto/sha2.h> header and the
> arch/x86/boot/string.h header. The latter provides its own prototypes
> for a lot of string functions which clash with the fortified macros
> from <linux/string.h>.
> The next patch will add #include <linux/string.h> to sha2.h to be able

This is exactly the problem - people are adding main include namespace headers
from linux/ to arch/x86/boot, or, as you do, to purgatory, which are special
- and then they have to do all kinds of hacks so that it builds.

(btw, there's no "next patch" in git history).

> to use memzero_explicit() there, so we have to compile the code in
> purgatory.c with -D__NO_FORTIFY to avoid compilation problems in this
> file.

How about you extract memzero_explicit() to a separate header in
include/asm-generic/ or simply put it in include/asm-generic/string.h and then
use that header instead?

Then you shouldn't have prototype clashes...

It does sound cleaner to me but you'd have to try it to see whether it
actually works.

Thx.

--
Regards/Gruss,
Boris.

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