login
Header Space

 
 

How to write in kernel memory

January 5, 2009 - 2:17am
Submitted by beparas on January 5, 2009 - 2:17am.
Linux

Hello Friends,
I want to write some data @ kernel addresses space 0xfa000000,
Plz suggest me How to copy the data @ this address space.

Start by typing "man kmem".

January 6, 2009 - 8:00pm
Ferdinand (not verified)

Start by typing "man kmem".

Use mmap to map 0xfa000000

January 7, 2009 - 8:57am
Anonymous (not verified)

Use mmap to map 0xfa000000 to low address using the file /dev/mem. It returns the ptr which u can use to write data.

OP specifically wants to

January 7, 2009 - 3:53pm
Ferdinand (not verified)

OP specifically wants to write to a kernel address, so must use /dev/kmem instead of /dev/mem.

/dev/kmem is read only by

January 10, 2009 - 7:56pm

/dev/kmem is read only by default in the .config, so you can never write to it.

How to write in kernel memory

January 16, 2009 - 9:55am
Subhasish Ghosh (not verified)

1. If ur trying to write into an IO mapped device register from the kernel, then you may straight away write into the address or use readl/writel variants depending on ur arch.

2. If you are debugging something from the kernel, then you may use the address straight away by assigning to a variable.

3. If ur trying to fix something and following point 2, ur in trouble.

4. If ur in user land, then safe way is using mmap.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary