Skip to content

Commit 4dbf96b

Browse files
authored
Merge pull request #9280 from douzzer/20251007-linuxkm-fortify-source-sunrise
20251007-linuxkm-fortify-source-sunrise
2 parents a3af514 + e4f0acd commit 4dbf96b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ WC_DILITHIUM_FIXED_ARRAY
602602
WC_DISABLE_RADIX_ZERO_PAD
603603
WC_ECC_NONBLOCK_ONLY
604604
WC_FLAG_DONT_USE_AESNI
605+
WC_FORCE_LINUXKM_FORTIFY_SOURCE
605606
WC_KDF_NIST_SP_800_56C
606607
WC_LMS_FULL_HASH
607608
WC_NO_RNG_SIMPLE

linuxkm/linuxkm_wc_port.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,25 @@
228228

229229
#include <linux/kconfig.h>
230230

231-
#if defined(CONFIG_FORTIFY_SOURCE) && defined(HAVE_LINUXKM_PIE_SUPPORT)
231+
#if defined(CONFIG_FORTIFY_SOURCE) && \
232+
!defined(WC_FORCE_LINUXKM_FORTIFY_SOURCE) && \
233+
(defined(HAVE_LINUXKM_PIE_SUPPORT) || \
234+
(LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)))
232235
/* fortify-source causes all sorts of awkward problems for the PIE
233236
* build, up to and including stubborn external references and multiple
234237
* definitions of string functions.
238+
*
239+
* fortify-source before kernel 5.18 has similar issues regardless of
240+
* PIE, around our macro-shimming of the string functions.
235241
*/
236242
#undef CONFIG_FORTIFY_SOURCE
237243
#endif
238244

245+
#if defined(WC_FORCE_LINUXKM_FORTIFY_SOURCE) && \
246+
!defined(CONFIG_FORTIFY_SOURCE)
247+
#error WC_FORCE_LINUXKM_FORTIFY_SOURCE without CONFIG_FORTIFY_SOURCE.
248+
#endif
249+
239250
#if defined(__PIE__) && defined(CONFIG_ARM64)
240251
#define alt_cb_patch_nops my__alt_cb_patch_nops
241252
#define queued_spin_lock_slowpath my__queued_spin_lock_slowpath

0 commit comments

Comments
 (0)