[root@localhost ~]# cat /dev/mem
cat: /dev/mem: No such file or directory
[root@localhost ~]# dmidecode -s system-product-name
TaiShan 200 (Model 2280)
[root@localhost ~]#
[root@localhost ~]# mknod -m 660 /dev/mem c 1 1 [root@localhost ~]# cat /dev/mem cat: /dev/mem: No such device or address [root@localhost ~]# chown root:kmem /dev/mem [root@localhost ~]# cat /dev/mem cat: /dev/mem: No such device or address
[root@localhost ~]# cat /boot/config-4.14.0-115.el7a.0.1.aarch64 | grep -Ee 'DEV(|K)MEM' # CONFIG_DEVMEM is not set CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y [root@localhost ~]#
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
[root@localhost ~]# cat /dev/mem cat: /dev/mem: Bad address [root@localhost ~]#
[root@localhost ~]# cat /boot/config-4.19.90-9.10.aarch64 | grep -Ee 'DEV(|K)MEM' CONFIG_DEVMEM=y CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y CONFIG_STRICT_DEVMEM=y CONFIG_IO_STRICT_DEVMEM=y [root@localhost ~]#
[root@localhost ~]# ./mem /dev/mem opened. [root@localhost ~]# cat mem.c #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/mman.h> int main() { int memfd; memfd = open("/dev/mem", O_RDWR | O_SYNC); if (memfd == -1) { printf("Can't open /dev/mem. "); exit(0); } printf("/dev/mem opened. "); close(memfd); } [root@localhost ~]#