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: Tue, 7 Sep 2010 20:25:36 +0200 [thread overview]
Message-ID: <20100907182536.GA21588@redhat.com> (raw)
In-Reply-To: <20100907111349.980032649@linutronix.de>
On 09/07, Thomas Gleixner wrote:
>
> Protect the task lookups in audit_receive_msg() with rcu_read_lock()
> instead of tasklist_lock and use lock/unlock_sighand to protect
> against the exit race.
I do not understand audit, but I belive both 1/3 and 3/3 patches are
fine (I didn't get 2/3).
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 ?
As for ->tty_audit_buf, I am not sure ->siglock is the best choice,
perhaps task_lock() would be better.
Once again, I think the patch is fine. Just it seems to me this code
needs more cleanups.
Oleg.
next prev parent reply other threads:[~2010-09-07 18:29 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 [this message]
2010-09-07 20:25 ` Thomas Gleixner
2010-09-08 12:44 ` Oleg Nesterov
-- 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=20100907182536.GA21588@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