- 論壇徽章:
- 15
|
/*
* Return zero if current may access user memory in @task, -error if not.
*/
static int check_mem_permission(struct task_struct *task)
{
/*
* A task can always look at itself, in case it chooses
* to use system calls instead of load instructions.
*/
if (task == current)
return 0;
/*
* If current is actively ptrace'ing, and would also be
* permitted to freshly attach with ptrace now, permit it.
*/
if (task_is_stopped_or_traced(task)) {
int match;
rcu_read_lock();
match = (tracehook_tracer_task(task) == current);
rcu_read_unlock();
if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH))
return 0;
}
/*
* Noone else is allowed.
*/
return -EPERM;
}
2.6.32的代碼,在讀取時(mem_read),進行權(quán)限檢查,看似只能看自己進程的mem,或者使用ptrace。所以通常都是不允許的。
我看新版本內(nèi)核中,應(yīng)該沒有這個權(quán)限判斷了,不知你用的是啥版本?
|
|