linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Oleg Nesterov <oleg@redhat.com>, Kees Cook <keescook@chromium.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	syzbot <syzbot+a9ac39bf55329e206219@syzkaller.appspotmail.com>,
	James Morris <jmorris@namei.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	syzkaller-bugs@googlegroups.com
Subject: Re: yama: unsafe usage of ptrace_relation->tracer
Date: Thu, 10 Jan 2019 20:05:47 +0900	[thread overview]
Message-ID: <0fc3493d-a50e-f386-20a8-28d348c19544@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20181029150546.GA30959@redhat.com>

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.
> 
> 


  reply	other threads:[~2019-01-10 11:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21  7:10 KASAN: use-after-free Read in task_is_descendant syzbot
2018-10-21  7:12 ` Tetsuo Handa
2018-10-22  9:54   ` Oleg Nesterov
2018-10-22 10:06     ` Tetsuo Handa
2018-10-22 13:46       ` Oleg Nesterov
2018-10-25  2:15         ` Tetsuo Handa
2018-10-25 11:13           ` Oleg Nesterov
2018-10-25 11:36             ` Kees Cook
2018-10-25 12:05               ` Oleg Nesterov
2018-10-25 11:47             ` Tetsuo Handa
2018-10-25 12:17               ` Oleg Nesterov
2018-10-25 13:01                 ` Oleg Nesterov
2018-10-26 16:09                   ` Kees Cook
2018-10-29 12:23                     ` Oleg Nesterov
2018-10-29 15:05                       ` yama: unsafe usage of ptrace_relation->tracer Oleg Nesterov
2019-01-10 11:05                         ` Tetsuo Handa [this message]
2019-01-10 18:47                           ` Kees Cook
2019-01-16 17:40                           ` Oleg Nesterov
2018-10-25 13:14                 ` KASAN: use-after-free Read in task_is_descendant Tetsuo Handa
2018-10-25 15:55                   ` Oleg Nesterov
2018-10-25 16:25                     ` Oleg Nesterov
2018-10-26 12:23                     ` Tetsuo Handa
2018-10-26 13:04                       ` Oleg Nesterov
2018-10-26 13:51                         ` Tetsuo Handa
2018-10-26 14:39                           ` Oleg Nesterov
2018-10-26 15:04                             ` Tetsuo Handa
2018-10-26 15:22                               ` Oleg Nesterov
2018-10-25  8:19     ` Kees Cook
2018-10-25 11:52       ` Oleg Nesterov
2018-11-10  3:25 ` syzbot
2018-11-10 11:46 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fc3493d-a50e-f386-20a8-28d348c19544@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=serge@hallyn.com \
    --cc=syzbot+a9ac39bf55329e206219@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).