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:
Code: Select all
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
Code: Select all
user@debian-macbook:~$ file /dev/kmem
/dev/kmem: character special (1/2)
Code: Select all
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
Thank you.
PS. Those options are enabled for sure:
Code: Select all
user@debian-macbook:~$ cat /boot/config-4.13.9 | grep -Ee 'DEV(|K)MEM'
CONFIG_DEVMEM=y
CONFIG_DEVKMEM=y
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set