1

Please help if You can. I need to debug access to some variable in kernel module throw mechanism, that allow to print stack each time, when an access is required. I know that the easiest way is to use HW breakpoint (also knows as watchpoint), https://github.com/torvalds/linux/blob/master/kernel/events/hw_breakpoint.c that use processor debug register, wrote to it monitor address, and can generate interupt, that can be handled by call back function that do everything, that You need.

But unfortunately in my project uses linux kernel with older version, then this functionality was added. So i can not upgrade project kernel due to project limitations. I found, that in kernel available watch.c: https://github.com/torvalds/linux/blob/master/arch/mips/kernel/watch.c Is this functions provide the similar functionality, like hw breakpoints, or no? I can not find documentation for this functions.

The root cause that i need this, is that somebody corrupt pointer to memory indirectly in kernel module, and as a result is "unaligned memory access kernel crash". So maybe presents some another debug techniques, that can help find a part of code, that do this, as alternative to breakpoints (watchpoints)? Thanks a lot in advance of any helpfully information.

Andriy Veres
  • 81
  • 1
  • 1
  • 5

0 Answers0