From: Oleg Nesterov <oleg@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Eric Paris <eparis@redhat.com>
Subject: Re: [patch 3/3] audit: Use rcu for task lookup protection
Date: Wed, 8 Sep 2010 14:44:06 +0200 [thread overview]
Message-ID: <20100908124406.GA5271@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1009072224080.2477@localhost6.localdomain6>
On 09/07, Thomas Gleixner wrote:
>
> On Tue, 7 Sep 2010, Oleg Nesterov wrote:
>
> > But, sorry, can't resists ;) off-topic nit.
> >
> > > @@ -873,17 +873,16 @@ static int audit_receive_msg(struct sk_b
> > > case AUDIT_TTY_GET: {
> > > struct audit_tty_status s;
> > > struct task_struct *tsk;
> > > + unsigned long flags;
> > >
> > > - read_lock(&tasklist_lock);
> > > + rcu_read_lock();
> > > tsk = find_task_by_vpid(pid);
> > > - if (!tsk)
> > > - err = -ESRCH;
> > > - else {
> > > - spin_lock_irq(&tsk->sighand->siglock);
> > > + if (tsk && lock_task_sighand(tsk, &flags)) {
> > > s.enabled = tsk->signal->audit_tty != 0;
> >
> > Yes, this is what original code does, it takes ->siglock every time
> > around read/write of ->audit_tty. And this looks absolutely bogus.
> > Say, tty_audit_fork(). Why does it take ->siglock ?
Yes, I still think ->audit_tty doesn't need the locking.
> > As for ->tty_audit_buf, I am not sure ->siglock is the best choice,
> > perhaps task_lock() would be better.
OOPS, I misread the code. ->tty_audit_buf is per-process (of course!).
Well, unless I missed something again, tty_audit_push() and
tty_audit_tiocsti() can access ->tty_audit_buf lockless.
> > Once again, I think the patch is fine. Just it seems to me this code
> > needs more cleanups.
>
> Yeah, thought about that, but that's not in the scope of what I was
> working on. I leave that to the audit folks. :)
Yes, yes, sure.
Oleg.
next prev parent reply other threads:[~2010-09-08 12:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 13:59 [patch 0/3] audit: Fixes and tasklist_lock -> RCU conversion - Resend Thomas Gleixner
2010-09-07 14:00 ` [patch 1/3] audit: Call tty_audit_push_task() outside preempt disabled Thomas Gleixner
2010-09-07 14:00 ` [patch 2/3] audit: Do not send uninitialized data for AUDIT_TTY_GET Thomas Gleixner
2010-09-07 14:00 ` [patch 3/3] audit: Use rcu for task lookup protection Thomas Gleixner
2010-09-07 18:25 ` Oleg Nesterov
2010-09-07 20:25 ` Thomas Gleixner
2010-09-08 12:44 ` Oleg Nesterov [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-12-09 14:19 [patch 0/3] audit: Fixes and tasklist_lock -> RCU conversion Thomas Gleixner
2009-12-09 14:19 ` [patch 3/3] audit: Use rcu for task lookup protection Thomas Gleixner
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=20100908124406.GA5271@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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