I have reformatted the commit log according to the gnupg coding style as in gnupg/doc/HACKING and created a v3 patch which follows.
common: Disable CPU speculation-related misfeatures * common/init.c (early_system_init): Disable CPU speculation-related misfeatures which are in fact vulnerabilities causing data leaks: - Speculative Store Bypass - Indirect Branch Speculation - Flush L1D Cache on context switch out of the task For further information see the kernel documentation: Documentation/userspace-api/spec_ctrl.rst Signed-off-by: Guido Trentalancia <gu...@trentalancia.com> diff -pru a/common/init.c b/common/init.c --- a/common/init.c 2024-05-15 12:33:38.000000000 +0200 +++ b/common/init.c 2025-06-27 12:35:33.543235132 +0200 @@ -29,6 +29,10 @@ #include <config.h> +#if defined(__linux__) +# include <sys/prctl.h> +#endif + #ifdef HAVE_W32_SYSTEM # if _WIN32_WINNT < 0x0600 # define _WIN32_WINNT 0x0600 /* Required for SetProcessDEPPolicy. */ @@ -131,6 +135,29 @@ writestring_via_estream (int mode, const void early_system_init (void) { +#if defined(__linux__) + +/* Disable CPU speculation-related misfeatures which are in + * fact vulnerabilities causing data leaks: see the kernel + * documentation: Documentation/userspace-api/spec_ctrl.rst + * + * - Speculative Store Bypass + * - Indirect Branch Speculation + * - Flush L1D Cache on context switch out of the task + */ +#ifdef PR_SPEC_STORE_BYPASS + prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_FORCE_DISABLE, 0, 0); +#endif + +#ifdef PR_SPEC_INDIRECT_BRANCH + prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_FORCE_DISABLE, 0, 0); +#endif + +#ifdef PR_SPEC_L1D_FLUSH + prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, PR_SPEC_FORCE_DISABLE, 0, 0); +#endif + +#endif /* __linux__ */ } On Thu, 03/07/2025 at 09.24 +0200, Werner Koch wrote: > Hi! > > I and other already explained that the way you propose the patches is > not acceptable: > > - No autoconf macros and possibly tests to decide whether to use the > feature. > > - No proper ChangeLog (see gnupg/doc/HACKING) > > > > Shalom-Salam, > > Werner > _______________________________________________ Gnupg-devel mailing list Gnupg-devel@gnupg.org https://lists.gnupg.org/mailman/listinfo/gnupg-devel