问题描述
我如何找出Linux内核保护了哪些寄存器,以防止用户程序集向它们写入数据?
How can I find out which registers are protected by the Linux kernel to keep user assembly from writing to them?
推荐答案
首先,请注意Linux内核本身并不真正保护寄存器.它所做的只是确保用户应用程序以3级特权(最低特权)运行.从这一点来看,是处理器对寄存器进行了强制保护.
First of all, note that the Linux kernel itself doesn't really protect registers. All it does is make sure user applications run with privilege level 3 (lowest privilege). From that point, it's the processor that enforces protection of registers.
这是只能从特权级别0(即,从内核)访问的寄存器列表:
Here is a list of registers that are only accessible from privilege level 0 (i.e., from the kernel):
- 控制寄存器(
CR0
-CR4
) -
GDTR
,LDTR
和IDTR
(全局/本地/中断描述符表寄存器) -
TR
(任务寄存器) - 调试寄存器(
DR0
-DR7
) - 所有型号专用寄存器(
MSR
s)
- Control registers (
CR0
-CR4
) GDTR
,LDTR
andIDTR
(Global/Local/Interrupt Descriptor Table Register)TR
(Task Register)- Debug registers (
DR0
-DR7
) - All Model Specific Registers (
MSR
s)
您应该阅读英特尔系统编程手册,以详细说明x86上的保护.
You should read Chapter 5 of Intel's System Programming Manual for a detailed explanation on protection on the x86.
这篇关于哪些寄存器在Linux中受到用户空间的保护?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!