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;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_LINUXKM_SIMD_X86 && WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED */
|
#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
|
#undef USE_SPLIT_PMD_PTLOCKS
|
||||||
#define USE_SPLIT_PMD_PTLOCKS 0
|
#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
|
#endif
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#ifndef SINGLE_THREADED
|
#ifndef SINGLE_THREADED
|
||||||
@ -267,8 +274,13 @@
|
|||||||
typeof(kvfree) *kvfree;
|
typeof(kvfree) *kvfree;
|
||||||
#endif
|
#endif
|
||||||
typeof(is_vmalloc_addr) *is_vmalloc_addr;
|
typeof(is_vmalloc_addr) *is_vmalloc_addr;
|
||||||
typeof(kmem_cache_alloc_trace) *kmem_cache_alloc_trace;
|
|
||||||
typeof(kmalloc_order_trace) *kmalloc_order_trace;
|
#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;
|
typeof(get_random_bytes) *get_random_bytes;
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||||
@ -402,8 +414,12 @@
|
|||||||
#define kvfree (wolfssl_linuxkm_get_pie_redirect_table()->kvfree)
|
#define kvfree (wolfssl_linuxkm_get_pie_redirect_table()->kvfree)
|
||||||
#endif
|
#endif
|
||||||
#define is_vmalloc_addr (wolfssl_linuxkm_get_pie_redirect_table()->is_vmalloc_addr)
|
#define is_vmalloc_addr (wolfssl_linuxkm_get_pie_redirect_table()->is_vmalloc_addr)
|
||||||
#define kmem_cache_alloc_trace (wolfssl_linuxkm_get_pie_redirect_table()->kmem_cache_alloc_trace)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||||
#define kmalloc_order_trace (wolfssl_linuxkm_get_pie_redirect_table()->kmalloc_order_trace)
|
#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)
|
#define get_random_bytes (wolfssl_linuxkm_get_pie_redirect_table()->get_random_bytes)
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#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;
|
wolfssl_linuxkm_pie_redirect_table.kvfree = kvfree;
|
||||||
#endif
|
#endif
|
||||||
wolfssl_linuxkm_pie_redirect_table.is_vmalloc_addr = is_vmalloc_addr;
|
wolfssl_linuxkm_pie_redirect_table.is_vmalloc_addr = is_vmalloc_addr;
|
||||||
wolfssl_linuxkm_pie_redirect_table.kmem_cache_alloc_trace =
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
|
||||||
kmem_cache_alloc_trace;
|
wolfssl_linuxkm_pie_redirect_table.kmalloc_trace =
|
||||||
wolfssl_linuxkm_pie_redirect_table.kmalloc_order_trace =
|
kmalloc_trace;
|
||||||
kmalloc_order_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;
|
wolfssl_linuxkm_pie_redirect_table.get_random_bytes = get_random_bytes;
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||||
|
Reference in New Issue
Block a user