What's the protection flags of memory allocated by malloc?

前端 未结 3 1579
既然无缘
既然无缘 2021-01-12 19:39

According to this thread,memory allocated by malloc at least have PROT_READ | PROT_EXEC,otherwise the contaned function can\'t be executed .

<
3条回答
  •  没有蜡笔的小新
    2021-01-12 19:58

    You may need to call mprotect to set the PROT_EXEC flag yourself, after the memory has been allocated.

    $ man mprotect

提交回复
热议问题