How to allocate an executable page in a Linux kernel module?

前端 未结 2 1178
遇见更好的自我
遇见更好的自我 2020-12-19 04:14

I\'m writing a Linux kernel module, and I\'d like to allocate an executable page. Plain kmalloc() returns a pointer within a non-executable page, and I get a ke

2条回答
  •  悲哀的现实
    2020-12-19 04:56

    #include 
    #include 
    ...
    char *p = __vmalloc(byte_size, GFP_KERNEL, PAGE_KERNEL_EXEC);
    ...
    if (p != NULL) vfree(p);
    

提交回复
热议问题