Issue
How can I find out which registers are protected by the Linux kernel to keep user assembly from writing to them?
Solution
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.
Here is a list of registers that are only accessible from privilege level 0 (i.e., from the kernel):
- 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)
You should read Chapter 5 of Intel's System Programming Manual for a detailed explanation on protection on the x86.
Answered By - mtvec Answer Checked By - Dawn Plyler (WPSolving Volunteer)