- 论坛徽章:
- 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),进行权限检查,看似只能看自己进程的mem,或者使用ptrace。所以通常都是不允许的。
我看新版本内核中,应该没有这个权限判断了,不知你用的是啥版本?
|
|