Skip to content

Commit 1fb8f5f

Browse files
authored
Merge pull request #8658 from douzzer/20250410-linuxkm-fixes
20250410-linuxkm-fixes
2 parents 38f951b + f609d42 commit 1fb8f5f

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

linuxkm/Kbuild

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
.ONESHELL:
2222
SHELL=bash
2323

24+
ifeq "$(KERNEL_ARCH)" "x86"
25+
KERNEL_ARCH_X86 := yes
26+
else ifeq "$(KERNEL_ARCH)" "x86_64"
27+
KERNEL_ARCH_X86 := yes
28+
else
29+
KERNEL_ARCH_X86 := no
30+
endif
31+
2432
ifeq "$(WOLFSSL_OBJ_FILES)" ""
2533
$(error $$WOLFSSL_OBJ_FILES is unset.)
2634
endif
@@ -31,9 +39,7 @@ endif
3139

3240
WOLFSSL_CFLAGS += -ffreestanding -Wframe-larger-than=$(MAX_STACK_FRAME_SIZE) -isystem $(shell $(CC) -print-file-name=include)
3341

34-
ifeq "$(KERNEL_ARCH)" "x86"
35-
WOLFSSL_CFLAGS += -mpreferred-stack-boundary=4
36-
else ifeq "$(KERNEL_ARCH)" "aarch64"
42+
ifeq "$(KERNEL_ARCH)" "aarch64"
3743
WOLFSSL_CFLAGS += -mno-outline-atomics
3844
else ifeq "$(KERNEL_ARCH)" "arm64"
3945
WOLFSSL_CFLAGS += -mno-outline-atomics
@@ -65,7 +71,7 @@ HOST_EXTRACFLAGS += $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CFLAGS) -static -
6571

6672
# "-mindirect-branch=keep -mfunction-return=keep" to avoid "undefined reference
6773
# to `__x86_return_thunk'" on CONFIG_RETHUNK kernels (5.19.0-rc7)
68-
ifeq "$(KERNEL_ARCH)" "x86"
74+
ifeq "$(KERNEL_ARCH_X86)" "yes"
6975
HOST_EXTRACFLAGS += -mindirect-branch=keep -mfunction-return=keep
7076
endif
7177

@@ -97,7 +103,7 @@ $(obj)/wolfcrypt/src/aes.o: ccflags-y = $(WOLFSSL_CFLAGS) $(WOLFSSL_CFLAGS_YES_V
97103
ifeq "$(ENABLED_LINUXKM_PIE)" "yes"
98104
PIE_FLAGS := -fPIE -fno-stack-protector -fno-toplevel-reorder
99105
PIE_SUPPORT_FLAGS := -DUSE_WOLFSSL_LINUXKM_PIE_REDIRECT_TABLE
100-
ifeq "$(KERNEL_ARCH)" "x86"
106+
ifeq "$(KERNEL_ARCH_X86)" "yes"
101107
PIE_FLAGS += -mcmodel=small -mindirect-branch=keep -mfunction-return=keep
102108
endif
103109
ifeq "$(KERNEL_ARCH)" "mips"

linuxkm/linuxkm_wc_port.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
* fortify_panic().
138138
*/
139139
extern void __my_fortify_panic(const char *name) __noreturn __cold;
140-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
140+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
141141
/* see linux 3d965b33e40d9 */
142142
#define fortify_panic(func, write, avail, size, retfail) \
143143
__my_fortify_panic(#func)
@@ -882,7 +882,11 @@
882882
*/
883883
#define key_update wc_key_update
884884

885-
#define lkm_printf(format, args...) printk(KERN_INFO "wolfssl: %s(): " format, __func__, ## args)
885+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
886+
#define lkm_printf(format, args...) _printk(KERN_INFO "wolfssl: %s(): " format, __func__, ## args)
887+
#else
888+
#define lkm_printf(format, args...) printk(KERN_INFO "wolfssl: %s(): " format, __func__, ## args)
889+
#endif
886890
#define printf(...) lkm_printf(__VA_ARGS__)
887891

888892
#ifdef HAVE_FIPS

linuxkm/module_hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ extern const unsigned int wolfCrypt_FIPS_ro_end[];
646646
#define FIPS_IN_CORE_KEY_SZ 32
647647
#define FIPS_IN_CORE_VERIFY_SZ FIPS_IN_CORE_KEY_SZ
648648
typedef int (*fips_address_function)(void);
649-
#define MAX_FIPS_DATA_SZ 100000
650-
#define MAX_FIPS_CODE_SZ 1000000
649+
#define MAX_FIPS_DATA_SZ 10000000
650+
#define MAX_FIPS_CODE_SZ 10000000
651651
extern int GenBase16_Hash(const byte* in, int length, char* out, int outSz);
652652

653653
static int updateFipsHash(void)

0 commit comments

Comments
 (0)