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

Borislav Petkov <[email protected]>
Newsgroups org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel
Message-ID <20260814152457.GBan8zSeYlWd_1oWkz@fat_crate.local>
On Thu, Aug 13, 2026 at 03:49:48PM +0200, Thomas Huth wrote:
> From: Thomas Huth <[email protected]>
> 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.