How to write in kernel memory

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

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".

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

Start by typing "man kmem".

Use mmap to map 0xfa000000

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

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

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

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

/dev/kmem is read only by

on
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

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

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.