All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: akpm@linux-foundation.org, mingo@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] core: allow setrlimit to non-current tasks
Date: Tue, 1 Sep 2009 18:22:15 +0200	[thread overview]
Message-ID: <20090901162215.GA7439@redhat.com> (raw)
In-Reply-To: <1251744974-29398-5-git-send-email-jirislaby@gmail.com>

Sorry, can't read these series today. Will try tomorrow.

But at first glance some parts looks suspicious to me,

On 08/31, Jiri Slaby wrote:
>
> @@ -1244,16 +1244,27 @@ int setrlimit(struct task_struct *tsk, unsigned int resource,
>
>  	if (new_rlim->rlim_cur > new_rlim->rlim_max)
>  		return -EINVAL;
> +
> +	/* protect tsk->signal and tsk->sighand from disappearing */
> +	read_lock_irq(&tasklist_lock);

Why _irq? We can take tasklist_lock for reading without disabling irqs.

And. Unless I misread the patch, update_rlimit_cpu() is called before
read_unlock_irq(&tasklist_lock), but update_rlimit_cpu() does
spin_unlock_irq(->siglock) and restores interrupts.

> +	if (!tsk->signal || !tsk->sighand) {

Please don't check !tsk->signal, !tsk->sighand is enough. If
we have ->sighand != NULL (under lock) ->signal must be valid.

But I dislike the fact the patch uses tasklist_lock. Can't
lock_task_sighand() work for you? (of course, in this case
update_rlimit_cpu() should be updated too).

Once again, I didn't actually read this series yet, sorry.

Oleg.


  reply	other threads:[~2009-09-01 16:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 18:56 [PATCH 1/6] SECURITY: selinux, fix update_rlimit_cpu parameter Jiri Slaby
2009-08-31 18:56 ` [PATCH 2/6] SECURITY: add task_struct to setrlimit Jiri Slaby
2009-08-31 19:07   ` Eric Paris
2009-09-01  8:51   ` James Morris
2009-08-31 18:56 ` [PATCH 3/6] core: add task_struct to update_rlimit_cpu Jiri Slaby
2009-09-01  8:51   ` James Morris
2009-08-31 18:56 ` [PATCH 4/6] core: split sys_setrlimit Jiri Slaby
2009-08-31 18:56 ` [PATCH 5/6] core: allow setrlimit to non-current tasks Jiri Slaby
2009-09-01 16:22   ` Oleg Nesterov [this message]
2009-08-31 18:56 ` [PATCH 6/6] FS: proc, make limits writable Jiri Slaby
2009-08-31 22:22 ` [PATCH 1/6] SECURITY: selinux, fix update_rlimit_cpu parameter James Morris
2009-09-01  6:20   ` Jiri Slaby
2009-09-01  8:48     ` James Morris
2009-09-01  8:50 ` James Morris

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=20090901162215.GA7439@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 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.