lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 10 Oct 2007 11:19:27 +0930
From:	David Newall <david@...idnewall.com>
To:	Gustavo Chain <g@...f.cl>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Reserve N process to root

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.)

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ