Since the release of the Linux 5.8 kernel the signature of *__vmalloc()
has changed from:
void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
To this
void *__vmalloc(unsigned long size, gfp_t gfp_mask)
Which means you cannot allocate executable memory via this function. So this is what your code will look like after that update:
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
return __vmalloc(len, GFP_KERNEL, PAGE_KERNEL_EXEC);
#else
return __vmalloc(len, GFP_KERNEL);
#endif
But this means, that without using the noexec
parameter for the kernel, it is not possible to vmalloc executable memory for Kernels >= 5.8.
What is the alternative here, or in other words, how can I still allocate executable memory after kernel 5.8?