diff --git a/.github/workflows/linuxkm.yml b/.github/workflows/linuxkm.yml index 8ea51b234..931e2d4c7 100644 --- a/.github/workflows/linuxkm.yml +++ b/.github/workflows/linuxkm.yml @@ -17,7 +17,8 @@ jobs: strategy: matrix: config: [ - 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-lkcapi-register=all --enable-all --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --enable-dual-alg-certs --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --enable-sp-asm --enable-crypttests --enable-reproducible-build CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096" --with-max-rsa-bits=16384' + 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-lkcapi-register=all --enable-all --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --enable-dual-alg-certs --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --enable-sp-asm --enable-crypttests CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096" --with-max-rsa-bits=16384', + 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-pie --enable-reproducible-build --enable-linuxkm-lkcapi-register=all --enable-all-crypto --enable-cryptonly --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --enable-sp-asm --enable-crypttests CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096" --with-max-rsa-bits=16384' ] name: build module if: github.repository_owner == 'wolfssl' @@ -27,7 +28,7 @@ jobs: - uses: actions/checkout@v4 name: Checkout wolfSSL - - name: Build libwolfssl.ko, targeting GitHub ubuntu-latest, with --enable-all, PQC, and smallstack and stack depth warnings + - name: Prepare target kernel for module builds run: | echo "updating linux-headers" sudo apt-get update || $(exit 2) @@ -38,8 +39,14 @@ jobs: sudo make -j 4 oldconfig || $(exit 7) sudo make M="$(pwd)" modules_prepare || $(exit 8) popd >/dev/null + + - name: autogen.sh + run: | ./autogen.sh || $(exit 9) - echo "running ./configure ... ${{ matrix.config }}" + + - name: Build libwolfssl.ko, targeting GitHub ubuntu-latest, with --enable-all, PQC, and smallstack and stack depth warnings + run: | + echo "running ./configure --with-linux-source=/lib/modules/$(uname -r)/build ${{ matrix.config }}" ./configure --with-linux-source=/lib/modules/$(uname -r)/build ${{ matrix.config }} || $(exit 10) # try to remove profiling (-pg) because it leads to "_mcleanup: gmon.out: Permission denied" make -j 4 KERNEL_EXTRA_CFLAGS_REMOVE=-pg FORCE_NO_MODULE_SIG=1 || $(exit 11) diff --git a/linuxkm/linuxkm_wc_port.h b/linuxkm/linuxkm_wc_port.h index 0caedae70..96e3be3a1 100644 --- a/linuxkm/linuxkm_wc_port.h +++ b/linuxkm/linuxkm_wc_port.h @@ -99,7 +99,7 @@ !defined(DONT_USE_KVMALLOC) && !defined(USE_KVMALLOC) #define USE_KVMALLOC #endif - #ifdef HAVE_KVREALLOC && \ + #if defined(HAVE_KVREALLOC) && \ !defined(DONT_USE_KVREALLOC) && !defined(USE_KVREALLOC) #define USE_KVREALLOC #endif @@ -690,13 +690,15 @@ const unsigned char *_ctype; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) typeof(kmalloc_noprof) *kmalloc_noprof; typeof(krealloc_noprof) *krealloc_noprof; typeof(kzalloc_noprof) *kzalloc_noprof; typeof(__kvmalloc_node_noprof) *__kvmalloc_node_noprof; typeof(__kmalloc_cache_noprof) *__kmalloc_cache_noprof; - typeof(kvrealloc_noprof) *kvrealloc_noprof; + #ifdef HAVE_KVREALLOC + typeof(kvrealloc_noprof) *kvrealloc_noprof; + #endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) typeof(kmalloc_noprof) *kmalloc_noprof; typeof(krealloc_noprof) *krealloc_noprof; @@ -963,14 +965,16 @@ #define _ctype WC_LKM_INDIRECT_SYM(_ctype) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 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) #define kzalloc_noprof WC_LKM_INDIRECT_SYM(kzalloc_noprof) #define __kvmalloc_node_noprof WC_LKM_INDIRECT_SYM(__kvmalloc_node_noprof) #define __kmalloc_cache_noprof WC_LKM_INDIRECT_SYM(__kmalloc_cache_noprof) - #define kvrealloc_noprof WC_LKM_INDIRECT_SYM(kvrealloc_noprof) + #ifdef HAVE_KVREALLOC + #define kvrealloc_noprof WC_LKM_INDIRECT_SYM(kvrealloc_noprof) + #endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) /* see include/linux/alloc_tag.h and include/linux/slab.h */ #define kmalloc_noprof WC_LKM_INDIRECT_SYM(kmalloc_noprof) @@ -978,7 +982,9 @@ #define kzalloc_noprof WC_LKM_INDIRECT_SYM(kzalloc_noprof) #define kvmalloc_node_noprof WC_LKM_INDIRECT_SYM(kvmalloc_node_noprof) #define kmalloc_trace_noprof WC_LKM_INDIRECT_SYM(kmalloc_trace_noprof) - #define kvrealloc_noprof WC_LKM_INDIRECT_SYM(kvrealloc_noprof) + #ifdef HAVE_KVREALLOC + #define kvrealloc_noprof WC_LKM_INDIRECT_SYM(kvrealloc_noprof) + #endif #else /* <6.10.0 */ #define kmalloc WC_LKM_INDIRECT_SYM(kmalloc) #define krealloc WC_LKM_INDIRECT_SYM(krealloc) diff --git a/linuxkm/module_hooks.c b/linuxkm/module_hooks.c index 389ff1f59..3d002e5d9 100644 --- a/linuxkm/module_hooks.c +++ b/linuxkm/module_hooks.c @@ -556,14 +556,18 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) { wolfssl_linuxkm_pie_redirect_table.kzalloc_noprof = kzalloc_noprof; wolfssl_linuxkm_pie_redirect_table.__kvmalloc_node_noprof = __kvmalloc_node_noprof; wolfssl_linuxkm_pie_redirect_table.__kmalloc_cache_noprof = __kmalloc_cache_noprof; +#ifdef HAVE_KVREALLOC wolfssl_linuxkm_pie_redirect_table.kvrealloc_noprof = kvrealloc_noprof; +#endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) wolfssl_linuxkm_pie_redirect_table.kmalloc_noprof = kmalloc_noprof; wolfssl_linuxkm_pie_redirect_table.krealloc_noprof = krealloc_noprof; wolfssl_linuxkm_pie_redirect_table.kzalloc_noprof = kzalloc_noprof; wolfssl_linuxkm_pie_redirect_table.kvmalloc_node_noprof = kvmalloc_node_noprof; wolfssl_linuxkm_pie_redirect_table.kmalloc_trace_noprof = kmalloc_trace_noprof; +#ifdef HAVE_KVREALLOC wolfssl_linuxkm_pie_redirect_table.kvrealloc_noprof = kvrealloc_noprof; +#endif #else wolfssl_linuxkm_pie_redirect_table.kmalloc = kmalloc; wolfssl_linuxkm_pie_redirect_table.krealloc = krealloc;