Thread (1 message) 1 message, 1 author, 2012-07-06

Fwd: before arm Linux 2.6.38, how to protect the kernel memory from accessing in user space?

From: Li Haifeng <hidden>
Date: 2012-07-06 23:36:39

Thank you.

I have got the answer too.

Before 2.6.38, the access permission management is still rely on
domain and AP field in Page table entry and Domain access control
register. The start-up code initialize the DOMAIN_USER by
DOMAIN_MANAGER. But in early_trap_init, the system will modify
DOMAIN_USER to DOMAIN_CLIENT. And when the domain attribute is
DOMAIN_CLIENT, the AP field in Page table entry will be effective.

2012/7/4 Russell King - ARM Linux [off-list ref]:
On Wed, Jul 04, 2012 at 02:01:25PM +0800, Li Haifeng wrote:
quoted
Hi, I am a newbie Linux Kernel learner. I am confused  at memory
protected between user space and kernel space.  In arm, the hardware
support the memory protecting by Domain access register.

But in Linux, it may not take effect in ARM Linux. Because before the
official kernel 2.6.38, I found that both DOMAIN_USER and
DOMAIN_KERNEL all set to DOMAIN_MANAGER(0x3). So, before arm Linux
2.6.38, how to protect the kernel memory from accessing in user space?
That doesn't sound right.

When we start booting, then the domain register will be set as that.
However, when we exec the first user thread (or indeed any user thread),
the user domain will be set to client mode (see the set_fs(USER_DS) in
fs/exec.c).
More accurately, in early_init_trap, the modify action will be done too ^_^.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help