From: Oleg Nesterov <oleg@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Mateusz Guzik <mguzik@redhat.com>,
linux-kernel@vger.kernel.org, Eric Paris <eparis@parisplace.org>,
James Morris <james.l.morris@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] rlimit: locking tidy ups
Date: Wed, 4 May 2016 19:39:11 +0200 [thread overview]
Message-ID: <20160504173910.GA1843@redhat.com> (raw)
In-Reply-To: <87r3dh4v6z.fsf@x220.int.ebiederm.org>
On 05/04, Eric W. Biederman wrote:
>
> Cc'd Oleg as he tends to be deeply involved with this class of locking.
>
> Mateusz Guzik <mguzik@redhat.com> writes:
>
> > proc_pid_limits takes ->sighand lock prior to accessing rlimits, but it
> > serves no purpose as it does not prevent modifications.
Well. I agree this all needs cleanups or at least additional comments, but
> > @@ -618,14 +618,12 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
> > struct pid *pid, struct task_struct *task)
> > {
> > unsigned int i;
> > - unsigned long flags;
> >
> > struct rlimit rlim[RLIM_NLIMITS];
> >
> > - if (!lock_task_sighand(task, &flags))
> > - return 0;
> > + task_lock(task->group_leader);
This is already unsafe. ->group_leader can point to nowhere if this threads
exits. lock_task_sighand() ensures that this can't happen.
> > - /* protect tsk->signal and tsk->sighand from disappearing */
> > - read_lock(&tasklist_lock);
> > - if (!tsk->sighand) {
> > - retval = -ESRCH;
> > - goto out;
> > + task_lock(tsk->group_leader);
The same, but yes the comment is misleading.
Oleg.
prev parent reply other threads:[~2016-05-04 18:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 15:51 [PATCH] rlimit: locking tidy ups Mateusz Guzik
2016-05-04 16:57 ` Eric W. Biederman
2016-05-04 17:39 ` Oleg Nesterov [this message]
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=20160504173910.GA1843@redhat.com \
--to=oleg@redhat.com \
--cc=ebiederm@xmission.com \
--cc=eparis@parisplace.org \
--cc=james.l.morris@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mguzik@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.