Linux Kernel : What is /dev/mem or /dev/kmem?
来源:互联网 发布:欧洲 人俄罗斯 知乎 编辑:程序博客网 时间:2024/06/05 06:43
本文转载至:http://priyaranjan-technicalzone.blogspot.com/2014/02/linux-kernel-what-is-devmem-or-devkmem.html
The /dev/mem and /dev/kmem character special files provide access to a pseudo device driver that allows read and write access to system memory or I/O address space.
Programs accessing these special files must have appropriate privilege. Commercial application programs should avoid using the /dev/mem and/dev/kmem files, since the virtual memory image is quite specific to the operating system level and machine platform. Use of these special files thus seriously affects the portability of the application program to other systems.When incorrect access to virtual memory is made through these files, process termination, a system crash, or loss of system data integrity can result.
/dev/mem
is the gateway to the "Physical Address Space"
of the processor which might include control registers of many HW peripherals and not just the RAM. In order to prevent attackers from misusing /dev/mem
and altering kernel memory, a flagCONFIG_STRICT_DEVMEM
needs to be enabled which will prevent user apps from accessing physical address space beyond 1MB. The option makes the kernel check addresses in /dev/mem with devmem_is_allowed() in arch/.../init.c Config Option in the Kernel
CONFIG_STRICT_DEVMEM:
│
│ If this option is disabled, you allow userspace (root) access to all
│ of memory, including kernel and userspace memory. Accidental
│ access to this is obviously disastrous, but specific access can
│ be used by people debugging the kernel. Note that with PAT support
│ enabled, even in this case there are restrictions on /dev/mem
│ use due to the cache aliasing requirements.
│
│ If this option is switched on, the /dev/mem file only allows
│ userspace access to PCI space and the BIOS code and data regions.
│ This is sufficient for dosemu and X and all common users of
│ /dev/mem.
│
│ If in doubt, say Y.
│
│ Symbol: STRICT_DEVMEM [=y]
│ Type : boolean
│ Prompt: Filter access to /dev/mem
│ Defined at arch/x86/Kconfig.debug:8
│ -> Kernel hacking
│
│ If this option is disabled, you allow userspace (root) access to all
│ of memory, including kernel and userspace memory. Accidental
│ access to this is obviously disastrous, but specific access can
│ be used by people debugging the kernel. Note that with PAT support
│ enabled, even in this case there are restrictions on /dev/mem
│ use due to the cache aliasing requirements.
│
│ If this option is switched on, the /dev/mem file only allows
│ userspace access to PCI space and the BIOS code and data regions.
│ This is sufficient for dosemu and X and all common users of
│ /dev/mem.
│
│ If in doubt, say Y.
│
│ Symbol: STRICT_DEVMEM [=y]
│ Type : boolean
│ Prompt: Filter access to /dev/mem
│ Defined at arch/x86/Kconfig.debug:8
│ -> Kernel hacking
0 0
- Linux Kernel : What is /dev/mem or /dev/kmem?
- /dev/mem /dev/kmem
- linux /dev/mem 和 /dev/kmem区别
- /dev/mem and /dev/kmem
- linux dev/mem dev/kmem实现访问物理/虚拟内存
- Linux下/dev/mem和/dev/kmem的区别
- Linux下/dev/mem和/dev/kmem的区别
- dev/kmem 和dev/mem的区别
- [总结] Linux下/dev/mem和/dev/kmem的区别及作用
- Linux下/dev/mem和/dev/kmem及操作gpio实例
- Linux下/dev/mem和/dev/kmem及操作gpio实例
- Linux下/dev/mem和/dev/kmem及操作gpio实例
- What is /dev/null
- 应用程序中对/dev/mem和/dev/kmem设备文件的访问
- 应用程序中对/dev/mem和/dev/kmem设备文件的访问
- Linux下/dev/mem和/dev/kmem的区别 本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux
- /dev/mem
- /dev/mem
- 职位要求。。。
- 控件调用setBackgroundResource,背景是XML文件时不显示
- HDU 2187 悼念512汶川大地震遇难同胞――老人是真饿了
- MetaQuotes Language 4 (MQL4)
- 学习笔记2-安卓开发环境搭建、创建虚拟机
- Linux Kernel : What is /dev/mem or /dev/kmem?
- 贝叶斯反垃圾邮件技术
- Velocity 学习资料
- Android 蓝牙开发详述
- hashcode问题
- cron 表达式 语法
- OpenStack中的VXLAN实现再思考(by quqi99)
- 摘要算法之MD5介绍及OpenSSL中MD5常用函数使用举例
- Struts2验证码