Tracing memory address access in kernel

Sudip Mukherjee sudipm.mukherjee at gmail.com
Fri Dec 7 14:49:31 EST 2018


Hi Pritam,

On Tue, Dec 4, 2018 at 10:26 AM Pritam Bankar
<pritambankar1988 at gmail.com> wrote:
>
> Hello,
>
> I am facing issue of memory corruption where only one field of
> allocated structure is getting corrupted. I have bio structure and one
> of the page in bio vector is getting set to NULL.
>
<snip>
>
> Is there any debugging technique / tool available which will track
> access to specific memory access?  I would like to dump stack every
> time bv_page is accessed or modified

In these types of cases I usually use KASAN, or HW Breakpoint.
with HW Breakpoint you can set an alert to monitor any read or write
operation on some memory location. Check
samples/hw_breakpoint/data_breakpoint.c for an example of breakpoints.
KASAN can give you stacktraces when illegal memory access is done.
Hope it helps.

-- 
Regards
Sudip



More information about the Kernelnewbies mailing list