关于CR0.WP

我们知道CR0的WP位可以关闭内核写保护。他和页表的R/W位有关。Intel手册中的描述绕来绕去似乎一直没有说到重点。

When the processor is in supervisor mode and the WP flag in register CR0 is clear (its 
state following reset initialization), all pages are both readable and writable (write-
protection is ignored). When the processor is in user mode, it can write only to user-
mode pages that are read/write accessible. User-mode pages which are read/write or 
read-only are readable; supervisor-mode pages are neither readable nor writable 
from user mode. A page-fault exception is generated on any attempt to violate the 
protection rules.
Starting with the P6 family, Intel processors allow user-mode pages to be write-
protected against supervisor-mode access. Setting CR0.WP = 1 enables supervisor-
mode sensitivity to user-mode, write protected pages. Supervisor pages which are 
read-only are not writable from any privilege level (if CR0.WP = 1). This supervisor 
write-protect feature is useful for implementing a “copy-on-write” strategy used by 
some operating systems, such as UNIX*, for task creation (also called forking or 
spawning). When a new task is created, it is possible to copy the entire address space 
of the parent task. This gives the child task a complete, duplicate set of the parent's 
segments and pages. An alternative copy-on-write strategy saves memory space and 
time by mapping the child's segments and pages to the same segments and pages 
used by the parent task. A private copy of a page gets created only when one of the 
tasks writes to the page. By using the WP flag and marking the shared pages as read-
only, the supervisor can detect an attempt to write to a user-level page, and can copy 
the page at that time.

经过试验明白了WP位的作用。

WP位是Supervisor的写保护位 (CPL < 3是Supervisor)

当WP = 1时,Supervisor不能写R/W没有置位的页。

WP = 0时,Supervisor可以写任何页。

对于User (CPL = 3), 无论WP是什么,都不能写R/W没有置位的页。所以User无论怎么样都是二等公民。

[轉]关于CR0.WP的更多相关文章

  1. 关于CR0寄存器

    开始的时候,我认为CR0.WP如果被置位,那么内存的页面只读属性将会失效,导致可以被写入数据. 这几天正好碰到一个问题,查看了资料才发现,之前的理解不完整. 引用Intel手册中的一句话: CR0.W ...

  2. [3]windows内核情景分析--内存管理

    32位系统中有4GB的虚拟地址空间 每个进程有一个地址空间,共4GB,(具体分为低2GB的用户地址空间+高2GB的内核地址空间) 各个进程的用户地址空间不同,属于各进程专有,内核地址空间部分则几乎完全 ...

  3. Windows虚拟地址转物理地址(原理+源码实现,附简单小工具)

                                                                                                        ...

  4. KVM的ept机制

    转载:http://ytliu.info/blog/2014/11/24/shi-shang-zui-xiang-xi-de-kvm-mmu-pagejie-gou-he-yong-fa-jie-xi ...

  5. system call hooking 系统调用增加或劫持

    1. 引言:这篇文章提供了一种增加自定义系统调用或劫持原有的系统调用的实现方法,只针对 linux 系统.主要思路是获取系统调用表 sys_call_table 地址,然后用新函数地址覆盖系统调用表某 ...

  6. PatentTips - Virtual translation lookaside buffer

    BACKGROUND OF THE INVENTION A conventional virtual-machine monitor (VM monitor) typically runs on a ...

  7. X86驱动:挂接SSDT内核钩子

    SSDT 中文名称为系统服务描述符表,该表的作用是将Ring3应用层与Ring0内核层,两者的API函数连接起来,起到承上启下的作用,SSDT并不仅仅只包含一个庞大的地址索引表,它还包含着一些其它有用 ...

  8. CR0,CR3寄存器

    驱动在hook系统函数的时候通常要将只读属性暂时的屏蔽掉,主要有三种方法 1.修改CR0寄存器的WP位,使只读属性失效(这是网上用的最多的方法),切忌使用完之后立马修改回来 2.只读的虚拟地址,通过C ...

  9. 通过修改CR0寄存器绕过SSDT驱动保护

    为了安全起见,Windows XP及其以后的系统将一些重要的内存页设置为只读属性,这样就算有权力访问该表也不能随意对其修改,例如SSDT.IDT等.但这种方法很容易被绕过,我们只要将这些部分修改为可写 ...

随机推荐

  1. VMware Workstation Pro 无法在Windows 上运行 检查可在Windows上运行的此应用的更新版

    1.问题描述 2.排查原因 国庆节后微软推送了一个新的更新补丁,更新之后发现VMware无法打开(未更新前正常). 3.解决方案 3.1卸载微软更新补丁 Windows 10的安全更新难以被彻底规避, ...

  2. Python快速设置Excel表格边框

    import xlwings as xw #打开存好的excel app = xw.App() #设置应用 wb = xw.Book("E:/Data/小蜜蜂超市销售报表.xlsx" ...

  3. luoguP1083 借教室(题解)(我用的线段树)

    luoguP1083 借教室 题目 #include<cstdio> #include<iostream> #include<cmath> #include< ...

  4. DNS解析全过程详解

    1.Chrome浏览器 会首先搜索浏览器自身的DNS缓存(缓存时间比较短,大概只有1分钟,且只能容纳1000条缓存),看自身的缓存中是否有www.linux178.com 对应的条目,而且没有过期,如 ...

  5. hibernate 常用注解

    转自:http://blog.csdn.net/numbibi/article/details/7739441 @content ejb3注解的API定义在javax.persistence.*包里面 ...

  6. HDFS学习笔记一

    一,HDFS是什么,HDFS有什么用,HDFS怎么用 HDFS:Hadoop Distribute File System 分布式文件系统 HDFS可以保证文件存储的可靠性, 二.HDFS的设计原则 ...

  7. 一个故事讲懂vue父子组件传值

    作者:李佳明同学链接:https://www.jianshu.com/p/2272b6ca0f0c 一个故事讲懂vue父子组件传值 讲故事前先讲代码 父组件向子组件传值 父组件数据传递给子组件可以通过 ...

  8. Vue路由组件vue-router

    一.路由介绍 Creating a Single-page Application with Vue + Vue Router is dead simple. With Vue.js, we are ...

  9. 版本控制系统之SVN和GIT的区别

    版本控制器的作用: 1. 可以协同代码管理,让多人开发代码得以实现. 2. 回归到以前的任何一个时间点的代码处(好比:开始写了很多代码,后面有修改了一些,突然IDE崩溃,但是发现还是以前的代码更好,这 ...

  10. html 中 获取百度代码

    1.登录百度地图api,地址:http://api.map.baidu.com/lbsapi/creatmap/index.html 2.设置你的地理位置,以北京大学为例子如图: