From: Gustavo Chain <g@0xff.cl>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Reserve N process to root
Date: Wed, 10 Oct 2007 01:15:23 -0400 [thread overview]
Message-ID: <20071010011523.7d6cca12@0xff.cl> (raw)
In-Reply-To: <470C2FA7.5030207@davidnewall.com>
El Wed, 10 Oct 2007 11:19:27 +0930
David Newall <david@davidnewall.com> escribió:
> Gustavo Chain wrote:
> > I think it's necessary to reserve some pids to the super user.
> > 5 must be sufficient.
>
> Why? (Sorry if I missed something.)
To prevent a posible DoS ?
>
> Shouldn't you test for error return before the pid is allocated?
> Otherwise, I think, you have to free it. Thus:
> > long do_fork(unsigned long clone_flags,
> > int __user *parent_tidptr,
> > int __user *child_tidptr)
> > {
> > +#define RESERVED_PIDS 5 /* danged if I know why */
> > +
> > + if (!capable(CAP_SYS_ADMIN) && nr_threads >= max_threads -
> > RESERVED_PIDS)
> > + return -EAGAIN;
> > +
> >
> > struct task_struct *p;
> > int trace = 0;
> > struct pid *pid = alloc_pid();
> > long nr;
> >
> > if (!pid)
> > return -EAGAIN;
> > nr = pid->nr;
> >
>
> (While I'm being picky, I don't like braces around a simple return,
> and neither, I note, does the style guide.)
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Gustavo Chaín Dumit
next prev parent reply other threads:[~2007-10-10 5:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-09 23:48 [PATCH] Reserve N process to root Gustavo Chain
2007-10-10 1:49 ` David Newall
2007-10-10 5:15 ` Gustavo Chain [this message]
2007-10-10 5:44 ` David Newall
2007-10-10 13:46 ` Gustavo Chain
2007-10-10 14:13 ` David Newall
2007-10-10 19:50 ` Valdis.Kletnieks
2007-10-10 21:02 ` g
2007-10-11 0:05 ` David Newall
-- strict thread matches above, loose matches on Subject: below --
2007-10-11 21:02 Al Boldi
2007-10-12 2:42 ` Kyle Moffett
2007-10-12 5:37 ` Al Boldi
2007-10-12 5:49 ` Kyle Moffett
2007-10-12 6:29 ` Al Boldi
2007-10-13 1:34 ` Gustavo Chain
2007-10-13 5:01 ` Al Boldi
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=20071010011523.7d6cca12@0xff.cl \
--to=g@0xff.cl \
--cc=linux-kernel@vger.kernel.org \
/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