mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
linuxkm/: fixes to deal with kernel 6.1+ show_free_areas() mess.
This commit is contained in:
@ -305,3 +305,19 @@
|
||||
return;
|
||||
}
|
||||
#endif /* WOLFSSL_LINUXKM_SIMD_X86 && WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED */
|
||||
|
||||
#if defined(__PIE__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
|
||||
/* needed in 6.1+ because show_free_areas() static definition in mm.h calls
|
||||
* __show_free_areas(), which isn't exported (neither was show_free_areas()).
|
||||
*/
|
||||
void my__show_free_areas(
|
||||
unsigned int flags,
|
||||
nodemask_t *nodemask,
|
||||
int max_zone_idx)
|
||||
{
|
||||
(void)flags;
|
||||
(void)nodemask;
|
||||
(void)max_zone_idx;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -105,6 +105,13 @@
|
||||
*/
|
||||
#undef USE_SPLIT_PMD_PTLOCKS
|
||||
#define USE_SPLIT_PMD_PTLOCKS 0
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
/* without this, static show_free_areas() mm.h brings in direct
|
||||
* reference to unexported __show_free_areas().
|
||||
*/
|
||||
#define __show_free_areas my__show_free_areas
|
||||
#endif
|
||||
#endif
|
||||
#include <linux/mm.h>
|
||||
#ifndef SINGLE_THREADED
|
||||
@ -267,8 +274,13 @@
|
||||
typeof(kvfree) *kvfree;
|
||||
#endif
|
||||
typeof(is_vmalloc_addr) *is_vmalloc_addr;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
typeof(kmalloc_trace) *kmalloc_trace;
|
||||
#else
|
||||
typeof(kmem_cache_alloc_trace) *kmem_cache_alloc_trace;
|
||||
typeof(kmalloc_order_trace) *kmalloc_order_trace;
|
||||
#endif
|
||||
|
||||
typeof(get_random_bytes) *get_random_bytes;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||
@ -402,8 +414,12 @@
|
||||
#define kvfree (wolfssl_linuxkm_get_pie_redirect_table()->kvfree)
|
||||
#endif
|
||||
#define is_vmalloc_addr (wolfssl_linuxkm_get_pie_redirect_table()->is_vmalloc_addr)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
#define kmalloc_trace (wolfssl_linuxkm_get_pie_redirect_table()->kmalloc_trace)
|
||||
#else
|
||||
#define kmem_cache_alloc_trace (wolfssl_linuxkm_get_pie_redirect_table()->kmem_cache_alloc_trace)
|
||||
#define kmalloc_order_trace (wolfssl_linuxkm_get_pie_redirect_table()->kmalloc_order_trace)
|
||||
#endif
|
||||
|
||||
#define get_random_bytes (wolfssl_linuxkm_get_pie_redirect_table()->get_random_bytes)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||
|
@ -394,10 +394,15 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) {
|
||||
wolfssl_linuxkm_pie_redirect_table.kvfree = kvfree;
|
||||
#endif
|
||||
wolfssl_linuxkm_pie_redirect_table.is_vmalloc_addr = is_vmalloc_addr;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||
wolfssl_linuxkm_pie_redirect_table.kmalloc_trace =
|
||||
kmalloc_trace;
|
||||
#else
|
||||
wolfssl_linuxkm_pie_redirect_table.kmem_cache_alloc_trace =
|
||||
kmem_cache_alloc_trace;
|
||||
wolfssl_linuxkm_pie_redirect_table.kmalloc_order_trace =
|
||||
kmalloc_order_trace;
|
||||
#endif
|
||||
|
||||
wolfssl_linuxkm_pie_redirect_table.get_random_bytes = get_random_bytes;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||
|
Reference in New Issue
Block a user