I have recently built linux kernel ver. 4.13.9, with config options CONFIG_DEVKMEM and CONFIG_DEVMEM. I need access to kernel memory because of the homework, I need to look at the File Descriptor Table of some process in memory (yes, I know about /proc filesystem, but I want to look at the exact structure in the kernel memory).

So, I built kernel with those options. /dev/mem is working fine, but when I try to read something from /dev/kmem, I'm getting following error:

user@debian-macbook:~$ sudo dd if=/dev/kmem bs=1k count=1 of=~/kmem
dd: error reading '/dev/kmem': No such device or address
0+0 records in
0+0 records out
0 bytes copied, 6.9563e-05 s, 0.0 kB/s

/dev/kmem is exist:

user@debian-macbook:~$ file /dev/kmem
/dev/kmem: character special (1/2)

I'm running Debian 9:

user@debian-macbook:~$ uname -a
Linux debian-macbook 4.13.9 #1 SMP Mon Oct 23 01:17:31 MSK 2017 x86_64 GNU/Linux
user@debian-macbook:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.2 (stretch)
Release:    9.2
Codename:   stretch

Please, tell me what is wrong with /dev/kmem, or maybe suggest a different approach?

Thank you.

PS. Those options are enabled for sure:

user@debian-macbook:~$ cat /boot/config-4.13.9 | grep -Ee 'DEV(|K)MEM'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.