The NZ Linux Resource

[WaiLUG] userspace and kernel space memory experiment

Nic Bellamy nic at bellamy.co.nz
Mon Jan 2 10:39:14 NZDT 2006


On Wed, 2005-12-28 at 21:13 +1300, John wrote:
>Hi guys, I have been trying to figure out how the Linux Memory
>management system works,
>I tried to write a small C program that is in a sleep loop waking up
>every 5 secs or so checking the value
>of a variable (it first prints out is userspace virtual address of the
>variable), I then wrote a module that tries
>to alter that memory location from kernel space. I have been doing
>this by traversing the pgd , pmd and pte arrays
>and have come to the conclusion I have know Idea what I am doing :-)
>and idea's on how this could be done ??

Oddly, I didn't see the original message.

A userspace virtual address is only unique when combined with the 
processes page tables; ie. it's perfectly plausible (and common) for 
multiple processes to be using the same virtual address space.

To test this out, run multiple copies of your userspace program 
simultaenously - you'll likely find they print out the same address in 
each case.

I have a copy of Understanding The Linux Kernel and also Liunx Device 
Drivers here - they may be useful to you.

One question though... uh... why do you want to do this?

Cheers,
	Nic.

-- 
Nic Bellamy <nic at bellamy.co.nz>
Bellamy Consulting -- Software & Security -- http://www.bellamy.co.nz/
Phone: +64-6-377-4957   Fax: +64-6-377-0505   Mobile: +64-21-251-8954



More information about the WaiLUG mailing list If you have any questions or comments about this page, email the Webmaster
Design Copyright © 1998-2005 Linux.net.nz