mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Anand Jahagirdar" <anandjigar@gmail.com>
To: "Daniel Hazelton" <dhazelton@enter.net>
Cc: Nix <nix@esperi.org.uk>, "Jens Axboe" <jens.axboe@oracle.com>,
	security@kernel.org, linux-kernel@vger.kernel.org,
	"Kedar Sovani" <kedar@dreamzgroup.com>
Subject: Re: Patch related with Fork Bombing Atack
Date: Mon, 4 Jun 2007 07:49:24 -0700	[thread overview]
Message-ID: <25ae38200706040749o1eb3b7bbs64a09e6c2e4d7331@mail.gmail.com> (raw)
In-Reply-To: <200706032129.29088.dhazelton@enter.net>

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

Hello All
            I am forwarding one improved patch related with Fork
Bombing Attack. This patch prints a message (only once) which alerts
administrator/root user about fork bombing attack. I created this
patch to implement my idea of informing administrator about fork
bombing attack on his machine only once.
    This patch overcomes all drawbacks of my previous patch related
with fork bombing attack and helps administrator. added comments will
definitely help developers.

Regards
Anand


On 6/3/07, Daniel Hazelton <dhazelton@enter.net> wrote:
> On Sunday 03 June 2007 19:01:21 Nix wrote:
> > On 1 Jun 2007, Jens Axboe told this:
> > > I think Anand is assuming that because syslog may coalesce identical
> > > messages into "repeated foo times" in the messages file, that it's not a
> > > dos. That is of course wrong.
> >
> > Not all syslog daemons do that, anyway. (syslog-ng doesn't, for one.)
>
> That syslog-ng doesn't coalesce repeated messages into a single line doesn't
> make a difference. The printk_ratelimit stuff is supposed to make it very
> hard to DOS a system by flooding syslog, but that doesn't mean its
> impossible.
>
> The point of this discussion was that having a part of the kernel log a
> message about a fork-bomb was a very large whole that could be used to DOS a
> system by flooding the syslog. (In fact, IIRC, the printk_ratelimit (and
> somebody, please correct me if I'm wrong) stuff uses a ring buffer and
> seriously spamming syslog, like the patch that spawned this thread would have
> done, could cause you to lose potentially important messages)
>
> DRH
>

[-- Attachment #2: fork.patch --]
[-- Type: application/octet-stream, Size: 1217 bytes --]

Index: root/Desktop/a1/linux-2.6.17.tar.bz2_FILES/linux-2.6.17/kernel/fork.c
===================================================================
--- root.orig/Desktop/a1/linux-2.6.17.tar.bz2_FILES/linux-2.6.17/kernel/fork.c	2007-06-04 17:46:03.000000000 +0530
+++ root/Desktop/a1/linux-2.6.17.tar.bz2_FILES/linux-2.6.17/kernel/fork.c	2007-06-04 17:47:14.000000000 +0530
@@ -957,7 +957,19 @@
 
 	retval = -EAGAIN;
 	
+	/*
+	 * following code prints a message which alerts administrator/root 		 * user about fork bombing Attack
+	 */
+	if ((atomic_read(&p->user->processes) >= (p->signal->rlim	[RLIMIT_NPROC].rlim_cur - 1)) && (atomic_read(&p->user->processes) < p->signal->rlim[RLIMIT_NPROC].rlim_cur)) {
+        	if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) && p->user != &root_user) {
+        		printk(KERN_CRIT"User with uid %d is crossing its Process limit\n",p->user->uid);
+        	}
+	}
 
+	/*
+	 * following code does not allow Non Root User to cross its process 
+	 * limit and it prevents Fork Bombing Attack.
+	 */
 	if (atomic_read(&p->user->processes) >= p->signal->rlim[RLIMIT_NPROC].rlim_cur) 
 		if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
 				p->user != &root_user) 

  reply	other threads:[~2007-06-04 14:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 13:45 Anand Jahagirdar
2007-05-31 13:46 ` Jens Axboe
2007-06-01  6:48   ` Anand Jahagirdar
2007-06-01  7:25     ` Daniel Hazelton
2007-06-01  7:30       ` Jens Axboe
2007-06-01  8:00         ` Daniel Hazelton
2007-06-01  8:02           ` Jens Axboe
2007-06-03 23:01         ` Nix
2007-06-04  1:29           ` Daniel Hazelton
2007-06-04 14:49             ` Anand Jahagirdar [this message]
2007-06-04 14:58               ` Jiri Kosina
2007-06-04 15:28                 ` Daniel Hazelton
2007-06-05 14:20                   ` Anand Jahagirdar
2007-06-01  8:38     ` Jiri Kosina
2007-06-01 14:29       ` Anand Jahagirdar

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=25ae38200706040749o1eb3b7bbs64a09e6c2e4d7331@mail.gmail.com \
    --to=anandjigar@gmail.com \
    --cc=dhazelton@enter.net \
    --cc=jens.axboe@oracle.com \
    --cc=kedar@dreamzgroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nix@esperi.org.uk \
    --cc=security@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®