davenkin
davenkin

Reputation: 131

In Linux, how user space cannot access kernel space?

In user space, if I try to access a virtual address in kernel space, where exactly does the protection happen?

Upvotes: 1

Views: 1301

Answers (2)

jiang shen
jiang shen

Reputation: 31

About the page table in arm/aarch64, there are some bits(AP[2:0]) to control the access; for the kernel address, it will set it as Read/Write by EL1(kernel) and None by EL0(user), and the protection will prevent user to access kernel address.

And for ArmV8.1, there is a bit PAN in PSTATE, to prevent kernel access user space, it's interesting ^^. check https://lwn.net/Articles/700623/ if you are interested.

Upvotes: 1

JosephH
JosephH

Reputation: 8815

User processes and kernels work on entirely different address space (except for the area where the kernel has to use when processing user process' system calls), the presumption that one can "try to access a virtual address in kernel space" is invalid.

Upvotes: 4

Related Questions