Possible to trap write to address (x86 - linux)

前端 未结 4 1592
悲哀的现实
悲哀的现实 2020-12-13 11:52

I want to be able to detect when a write to memory address occurs -- for example by setting a callback attached to an interrupt. Does anyone know how?

I\'d like to b

4条回答
  •  我在风中等你
    2020-12-13 12:21

    If you want to intercept writes to a range of addresses, you can use mprotect() to mark the memory in question as non-writeable, and install a signal handler using sigaction() to catch the resulting SIGSEGV, do your logging or whatever and mark the page as writeable again.

提交回复
热议问题