From: Ales Novak <alnovak@suse.cz>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH] ptrace: clear TIF_SYSCALL_TRACE on ptrace detach
Date: Thu, 1 Sep 2016 21:50:51 +0200 [thread overview]
Message-ID: <20160901195051.aevh2miogutgobzk@alesak.suse.cz> (raw)
In-Reply-To: <20160901164613.GA13138@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
On Thu, Sep 01, 2016 at 06:46:13PM +0200, Oleg Nesterov wrote:
> On 09/01, Ales Novak wrote:
> >
> > On ptrace_detach(), the TIF_SYSCALL_TRACE in thread->flags of the tracee
> > is not cleared up. This results in the tracehook_report_syscall_* being
> > called (though there's no longer a tracer listening to that) upon its
> > further syscalls.
> >
> > Example scenario - attach "strace" to a running process and kill it (the
> > strace) with SIGKILL. You'll see that the syscall trace hooks are still
> > being called.
>
> We do not really care, if the tracer dies the tracee can be in the
> inconsistent state anyway.
>
> > --- a/kernel/ptrace.c
> > +++ b/kernel/ptrace.c
> > @@ -85,6 +85,7 @@ void __ptrace_unlink(struct task_struct *child)
> > task_clear_jobctl_pending(child, JOBCTL_TRAP_MASK);
> > task_clear_jobctl_trapping(child);
> >
> > + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
>
> OK, probably this change makes sense anyway, but then you should
> remove another clear_tsk_thread_flag(TIF_SYSCALL_TRACE) in ptrace_detach?
You're right, sorry for not noticing that. Also my changelog was
misleading, I've tried to fix that.
>
> And I'd suggest to move this clear_tsk_thread_flag() up, before
> spin_lock(siglock). Otherwise it looks as if we should clear this flag
> with ->siglock held.
Good point also.
>
> Oleg.
>
--
Ales Novak
SUSE L3
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-09-01 21:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 13:54 Ales Novak
2016-09-01 16:46 ` Oleg Nesterov
2016-09-01 19:50 ` Ales Novak [this message]
2016-09-01 19:51 ` Ales Novak
2016-09-02 12:25 ` Oleg Nesterov
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=20160901195051.aevh2miogutgobzk@alesak.suse.cz \
--to=alnovak@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.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
all inboxes | Powered by JetHome®