Can I write-protect every page in the address space of a Linux process?

前端 未结 2 1726
轻奢々
轻奢々 2021-01-03 00:19

I\'m wondering if there\'s a way to write-protect every page in a Linux process\' address space (from inside of the process itself, by way of mprotect()). By \

2条回答
  •  执念已碎
    2021-01-03 01:11

    Start simple. Write-protect a few page and make sure your signal handler works for these pages. Then worry about expanding the scope of the protection. For example, you probably do not need to write-protect the code-section: operating systems can implement write-or-execute protection semantics on memory that will prevent code sections from ever being written to:

    • http://en.wikipedia.org/wiki/Self-modifying_code#Operating_systems

提交回复
热议问题