Re: yama: unsafe usage of ptrace_relation->tracer

From
Oleg Nesterov <oleg@redhat.com>
Date
2019-01-16 17:40:11
Also in
lkml
Reply to
Tetsuo Handa, 2019-01-10
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;
Thread (31 messages) 31 messages, 4 authors, last reply 2019-01-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help