[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0fc3493d-a50e-f386-20a8-28d348c19544@I-love.SAKURA.ne.jp>
Date: Thu, 10 Jan 2019 20:05:47 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: Oleg Nesterov <oleg@...hat.com>, Kees Cook <keescook@...omium.org>
Cc: "Serge E. Hallyn" <serge@...lyn.com>,
syzbot <syzbot+a9ac39bf55329e206219@...kaller.appspotmail.com>,
James Morris <jmorris@...ei.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-security-module <linux-security-module@...r.kernel.org>,
syzkaller-bugs@...glegroups.com
Subject: Re: yama: unsafe usage of ptrace_relation->tracer
Hello, Kees.
syzbot is hitting this problem as of linux-next-20190110.
When a patch will be proposed?
On 2018/10/30 0:05, Oleg Nesterov wrote:
> let me change the subject to avoid the confusion with the already confusing
> disccussion about task_is_descendant().
>
> On 10/29, Oleg Nesterov wrote:
>>
>> I still think we need a single pid_alive() check and I even sent the patch.
>> Attached again at the end.
>>
>> To clarify, let me repeat that ptracer_exception_found() may need some fixes
>> too, right now I am only talking about task_is_descendant().
>
> so yes, the ptracer_relations code looks very broken to me, but perhaps I
> misread this code, please correct me.
>
> RCU can only protect the ptracer_relations list itself, you can do nothing
> with (say) relation->tracer. relation->tracer can be already freed when
> ptracer_exception_found() checks relation->tracee == tracee.
>
> Not only pid_alive(parent) can not help in this case, pid_alive(parent) is
> equally unsafe because, again, this memory can be freed.
>
> security_task_free(tsk) is called right before free_task(tsk), there is no
> a gp pass in between, and of course we can't rely on the ->invalid check.
>
> _At first glance_ we can fix this if we simply turn both ->tracer/tracee
> pointers into "signal_struct *", then we can turn all same_thread_group()'s
> into walker->signal == parent which doesn't need to dereference the possibly-
> freed parent. This also allows to remove all thread_group_leader() checks.
> We need to ensure that false-positive is not possible (if, say, ->tracer
> was already re-allocated and points to another task->signal), but this
> doesn't look difficult.
>
> Oleg.
>
>
Powered by blists - more mailing lists