linuxkm/Kbuild: add KERNEL_EXTRA_CFLAGS_REMOVE;

linuxkm/linuxkm_wc_port.h: fix version threshold for HAVE_KVREALLOC (6.12.0, not 6.11.0), and add manual overrides.
This commit is contained in:
Daniel Pouzzner
2025-07-23 14:31:52 -05:00
parent 8d7009e9de
commit a447a991b0
3 changed files with 29 additions and 11 deletions

View File

@@ -193,6 +193,10 @@ DILITHIUM_MUL_QINV_SLOW
DILITHIUM_MUL_Q_SLOW
DILITHIUM_MUL_SLOW
DILITHIUM_USE_HINT_CT
DONT_HAVE_KVMALLOC
DONT_HAVE_KVREALLOC
DONT_USE_KVMALLOC
DONT_USE_KVREALLOC
DTLS_RECEIVEFROM_NO_TIMEOUT_ON_INVALID_PEER
ECCSI_ORDER_MORE_BITS_THAN_PRIME
ECC_DUMP_OID

View File

@@ -129,6 +129,10 @@ ifeq "$(ENABLED_LINUXKM_PIE)" "yes"
$(obj)/linuxkm/module_hooks.o: ccflags-y += $(PIE_SUPPORT_FLAGS)
endif
ifdef KERNEL_EXTRA_CFLAGS_REMOVE
ccflags-remove-y += KERNEL_EXTRA_CFLAGS_REMOVE
endif
$(obj)/wolfcrypt/benchmark/benchmark.o: ccflags-y = $(WOLFSSL_CFLAGS) $(CFLAGS_FPU_ENABLE) $(CFLAGS_SIMD_ENABLE) $(PIE_SUPPORT_FLAGS) -DNO_MAIN_FUNCTION -DWOLFSSL_NO_OPTIONS_H
$(obj)/wolfcrypt/benchmark/benchmark.o: asflags-y = $(WOLFSSL_ASFLAGS) $(ASFLAGS_FPU_ENABLE_SIMD_DISABLE)

View File

@@ -81,28 +81,38 @@
* kvrealloc() added in de2860f463, merged for 5.15, backported to 5.10.137.
* moved to ultimate home (slab.h) in 8587ca6f34, merged for 5.16.
*
* however, until 6.11, it took an extra argument, oldsize, that makes it
* incompatible with traditional libc usage patterns, so we don't try to use it.
* however, until 6.12 (commit 590b9d576c), it took an extra argument,
* oldsize, that makes it incompatible with traditional libc usage patterns,
* so we don't try to use it.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) && \
!defined(DONT_HAVE_KVMALLOC) && !defined(HAVE_KVMALLOC)
#define HAVE_KVMALLOC
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) && \
!defined(DONT_HAVE_KVREALLOC) && !defined(HAVE_KVREALLOC)
#define HAVE_KVREALLOC
#endif
#ifdef WOLFCRYPT_ONLY
#ifdef HAVE_KVMALLOC
#if defined(HAVE_KVMALLOC) && \
!defined(DONT_USE_KVMALLOC) && !defined(USE_KVMALLOC)
#define USE_KVMALLOC
#endif
#ifdef HAVE_KVREALLOC
#ifdef HAVE_KVREALLOC && \
!defined(DONT_USE_KVREALLOC) && !defined(USE_KVREALLOC)
#define USE_KVREALLOC
#endif
#else
/* functioning realloc() is needed for the TLS stack. */
#if defined(HAVE_KVMALLOC) && defined(HAVE_KVREALLOC)
#define USE_KVMALLOC
#define USE_KVREALLOC
#if defined(HAVE_KVMALLOC) && defined(HAVE_KVREALLOC) && \
!defined(DONT_USE_KVMALLOC) && !defined(DONT_USE_KVREALLOC)
#ifndef USE_KVMALLOC
#define USE_KVMALLOC
#endif
#ifndef USE_KVREALLOC
#define USE_KVREALLOC
#endif
#endif
#endif
@@ -680,7 +690,7 @@
const unsigned char *_ctype;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
typeof(kmalloc_noprof) *kmalloc_noprof;
typeof(krealloc_noprof) *krealloc_noprof;
typeof(kzalloc_noprof) *kzalloc_noprof;
@@ -953,7 +963,7 @@
#define _ctype WC_LKM_INDIRECT_SYM(_ctype)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
/* see include/linux/alloc_tag.h and include/linux/slab.h */
#define kmalloc_noprof WC_LKM_INDIRECT_SYM(kmalloc_noprof)
#define krealloc_noprof WC_LKM_INDIRECT_SYM(krealloc_noprof)