Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2000 10:57:11 +0100
From:      "Thomas Klein" <Thomas.Klein@KryptoKom.DE>
To:        freebsd-hackers@FreeBSD.org
Subject:   Re: how to catch a wildrunning pointer
Message-ID:  <C125687A.0036ACF0.00@nt-notes.kryptokom.de>

next in thread | raw e-mail | index | archive | help







Alfred Perlstein <bright@wintelcom.net> on 28.01.2000 11:49:34

To:   Thomas Klein/Aachen/Utimaco/DE@utimaco
cc:   freebsd-hackers@FreeBSD.ORG

Subject:  Re: how to catch a wildrunning pointer






> >
> > Hi
> >
> > My Problem:
> > Within a kernel timeout routine I allocate memory and fill it with data.
> > After a while I lock at this data again and realize that it it was modifyted
> > (but not by me).
> > How can I set a kernel mode watch point to that data to see which function
> > change the data.
> >
> > Any Ideas ????
>
> Look at the vm code, you can probably write protect the pages while
> you aren't accessing them, this will cause offending code to panic
> the machine so you can figure out who is twiddling your bits.
>
> Of course you'll have to unprotect the memory when you want to access
> it for legitimate reasons.
>
> You owe the oracle a how-to on acually doing this, a paragraph or two
> would suffice.
>
> thanks,
> -Or^H^HAlfred


If I understand this correctly I have to use the pmap_protect function.

For testing I integrate the following sequence within a device driver
attach routine.

     {
          int i;
          char * t_ptr;

          t_ptr = (char*) malloc(1027,M_DEVBUF,M_NOWAIT);
          for(i=0;i<1027,i++)
               *t_ptr = 'x';
          pmap_protect(kmem_map,t_ptr,t_prt + 1027,VM_PROT_READ);
          *t_ptr = 'A';
          printf("I can see this\n");
     }

No exception ocured.
What is wrong?
Wy dosn't it work?

Regards Thomas






To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C125687A.0036ACF0.00>