mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: "Anand Jahagirdar" <anandjigar@gmail.com>
Cc: "Chris Snook" <csnook@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: Fork Bombing Patch
Date: Thu, 23 Aug 2007 13:52:20 +0200	[thread overview]
Message-ID: <m3d4xeii2z.fsf@maximus.localdomain> (raw)
In-Reply-To: <25ae38200708212317h7776768v33a82f646ac6b749@mail.gmail.com> (Anand Jahagirdar's message of "Wed, 22 Aug 2007 11:47:18 +0530")

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

  reply	other threads:[~2007-08-23 11:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16  6:24 Anand Jahagirdar
2007-08-16  7:40 ` Petr Tesarik
2007-08-17  7:19   ` Paul Jackson
2007-08-17  7:42     ` Petr Tesarik
2007-08-17  9:05       ` Paul Jackson
2007-08-16 11:19 ` Krzysztof Halasa
2007-08-16 11:27   ` Jan Engelhardt
2007-08-20 14:26   ` Anand Jahagirdar
2007-08-20 14:38     ` Jesper Juhl
2007-08-16 21:06 ` Chris Snook
2007-08-20 14:24   ` Anand Jahagirdar
2007-08-20 14:42     ` Chris Snook
2007-08-22  6:17       ` Anand Jahagirdar
2007-08-23 11:52         ` Krzysztof Halasa [this message]
2007-08-23 19:01           ` Chris Snook
2007-08-23 21:47             ` Krzysztof Halasa
     [not found]               ` <7b9198260708231737t33923ec6yde48bb1338a6fa70@mail.gmail.com>
2007-08-24  0:37                 ` Tom Spink
2007-08-29  9:48             ` Anand Jahagirdar
2007-08-29 11:29               ` Simon Arlott
2007-08-29 11:54                 ` Anand Jahagirdar
2007-08-29 13:49                   ` Chris Snook
2007-09-02  8:52                     ` Kyle Moffett
     [not found]                     ` <25ae38200806180502i4d78e240l210b261f05f10507@mail.gmail.com>
     [not found]                       ` <25ae38200806180505m61d51440ma5754fa817dfbc0b@mail.gmail.com>
2008-06-18 13:39                         ` Chris Snook

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=m3d4xeii2z.fsf@maximus.localdomain \
    --to=khc@pm.waw.pl \
    --cc=anandjigar@gmail.com \
    --cc=csnook@redhat.com \
    --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

all inboxes | Powered by JetHome®