lkml.org 
[lkml]   [2007]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Fork Bombing Patch
From
Date
Hi,

"Anand Jahagirdar" <anandjigar@gmail.com> writes:

> I am forwarding one more improved patch which i have modified as
> per your suggestions. Insted of KERN_INFO i have used KERN_NOTICE and
> i have added one more if block to check hard limit. how good it is?

Not very, still lacks "#ifdef CONFIG_something" and the required
Kconfig change (or other runtime thing defaulting to "no printk").

And now, it seems, the "goto bad_fork_tree" (not only printk())
ignores the soft limit -> really bad.

> +++ root/Desktop/a1/linux-2.6.17.tar.bz2_FILES/linux-2.6.17/kernel/fork.c 2007-06-26 20:41:41.000000000 +0530
> @@ -957,12 +957,19 @@
>
> retval = -EAGAIN;
>
> -
> + /*
> + * following code does not allow Non Root User to cross its process
> + * limit and it alerts administrator about user Nearing the process limit.
> + */
> +
> if (atomic_read(&p->user->processes) >= p->signal->rlim[RLIMIT_NPROC].rlim_cur)
> + if (atomic_read(&p->user->processes) >= p->signal->rlim[RLIMIT_NPROC].rlim_max)
> if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
> - p->user != &root_user)
> + p->user != &root_user) {
> + if (printk_ratelimit())
> + printk(KERN_NOTICE "User with uid %u is Nearing the process limit\n",p->user->uid);
> +
> goto bad_fork_free;
> -
> + }
>
> atomic_inc(&p->user->__count);
> atomic_inc(&p->user->processes);

--
Krzysztof Halasa
-
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/

\
 
 \ /
  Last update: 2007-08-23 13:55    [W:3.321 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site