Messages in this thread Patch in this message | | | Date | Wed, 16 Jan 2019 18:40:04 +0100 | From | Oleg Nesterov <> | Subject | Re: yama: unsafe usage of ptrace_relation->tracer |
| |
On 01/10, Tetsuo Handa wrote: > > syzbot is hitting this problem as of linux-next-20190110. > When a patch will be proposed?
Well. I have already suggested the patch below several times. It won't fix all problems in this code (I forgot the details but iirc ptracer_exception_found() is broken too, task_is_descendant() should be cleanuped, may be something else), but probably this trivial fix makes sense for the start?
Oleg.
--- x/security/yama/yama_lsm.c +++ x/security/yama/yama_lsm.c @@ -368,7 +368,8 @@ static int yama_ptrace_access_check(stru break; case YAMA_SCOPE_RELATIONAL: rcu_read_lock(); - if (!task_is_descendant(current, child) && + if (!pid_alive(child) || + !task_is_descendant(current, child) && !ptracer_exception_found(current, child) && !ns_capable(__task_cred(child)->user_ns, CAP_SYS_PTRACE)) rc = -EPERM;
| |