[轉]关于CR0.WP
关于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的更多相关文章
- 关于CR0寄存器
开始的时候,我认为CR0.WP如果被置位,那么内存的页面只读属性将会失效,导致可以被写入数据. 这几天正好碰到一个问题,查看了资料才发现,之前的理解不完整. 引用Intel手册中的一句话: CR0.W ...
- [3]windows内核情景分析--内存管理
32位系统中有4GB的虚拟地址空间 每个进程有一个地址空间,共4GB,(具体分为低2GB的用户地址空间+高2GB的内核地址空间) 各个进程的用户地址空间不同,属于各进程专有,内核地址空间部分则几乎完全 ...
- Windows虚拟地址转物理地址(原理+源码实现,附简单小工具)
...
- KVM的ept机制
转载:http://ytliu.info/blog/2014/11/24/shi-shang-zui-xiang-xi-de-kvm-mmu-pagejie-gou-he-yong-fa-jie-xi ...
- system call hooking 系统调用增加或劫持
1. 引言:这篇文章提供了一种增加自定义系统调用或劫持原有的系统调用的实现方法,只针对 linux 系统.主要思路是获取系统调用表 sys_call_table 地址,然后用新函数地址覆盖系统调用表某 ...
- PatentTips - Virtual translation lookaside buffer
BACKGROUND OF THE INVENTION A conventional virtual-machine monitor (VM monitor) typically runs on a ...
- X86驱动:挂接SSDT内核钩子
SSDT 中文名称为系统服务描述符表,该表的作用是将Ring3应用层与Ring0内核层,两者的API函数连接起来,起到承上启下的作用,SSDT并不仅仅只包含一个庞大的地址索引表,它还包含着一些其它有用 ...
- CR0,CR3寄存器
驱动在hook系统函数的时候通常要将只读属性暂时的屏蔽掉,主要有三种方法 1.修改CR0寄存器的WP位,使只读属性失效(这是网上用的最多的方法),切忌使用完之后立马修改回来 2.只读的虚拟地址,通过C ...
- 通过修改CR0寄存器绕过SSDT驱动保护
为了安全起见,Windows XP及其以后的系统将一些重要的内存页设置为只读属性,这样就算有权力访问该表也不能随意对其修改,例如SSDT.IDT等.但这种方法很容易被绕过,我们只要将这些部分修改为可写 ...
随机推荐
- 在$CF$水题の记录
CF1158C CF1163E update after CF1173 很好,我!expert!掉rating了!! 成为pupil指日可待== 下次要记得合理安排时间== ps.一道题都没写的\(a ...
- SpringBoot-技术专区-配置文件加密
工程中的配置文件如果把数据库的用户名密码写成明文的话是一件很危险的事情,之前也看见网上说可以对密码进行加密,用的时候再解密,因此今天我就尝试如何在spring boot 中的项目中实现关键信息的加密解 ...
- 2019牛客暑期多校训练营(第三场)I Median
题意:给出n-2的中位数序列b,b[i]代表原序列中(a[i],a[i+1],a[i+2])的中位数,求a. 解法:比赛的时候没做出来,赛后看题解的.解法跟网上各位大佬一样:首先要证明其实原序列a中的 ...
- jvm加载包名和类名相同的类的规则,以及如何加载包名和类名相同的类(转)
jvm包括三种类加载器: 第一种:bootstrap classloader:加载java的核心类. 第二种:extension classloader:负责加载jre的扩展目录中的jar包. 第三种 ...
- 程序猿必备的10款web前端动画插件
1.基于jQuery的瀑布流图片筛选插件 瀑布流的展现方式在目前的网页中用得越来越广泛,特别是图片和首页文章的动态加载. 今天分享的这款就是基于jQuery的瀑布流图片筛选插件,我们可以点击图片分类名 ...
- 【vlfeat】O(n)排序算法——计数排序
今天想在网上找一个实现好的er算法来着,没啥具体的资料,无奈只能看vlfeat的mser源码,看能不能修修补补实现个er. 于是,看到某一段感觉很神奇,于是放下写代码,跑来写博客,也就是这段 /* - ...
- postgres之使用python连接并操作
取一万个随机数,插入数据库 import random import psycopg2 import string conn=psycopg2.connect(database='postgres', ...
- idea创建ssm框架步骤
打开idea 编辑器 File>new >project 选择Maven 右边勾选Create from archctype 然后下拉选择org.apache.maven.archet ...
- python字符串的截取,查找
1.字符串的截取 str = "123456" str[:3] = 123 str[1:3] = 23 str[0:-1] = 12345 里面的数字都是index索引,从第一个索 ...
- 文本处理工具——sed进阶
一sed的搜索替代 (一)常见的和替代相关的选项 搜索替代,和vim的写法很像 s///:查找替换,支持使用其它分隔符,s@@@,s### p: 显示替换成功的行,就是打印. w /PATH/TO/S ...