public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Patch Related with Fork Bombing Attack
@ 2007-07-13 12:39 Anand Jahagirdar
  2007-07-14  9:40 ` WANG Cong
  2007-07-15  8:48 ` Simon Arlott
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Jahagirdar @ 2007-07-13 12:39 UTC (permalink / raw)
  To: linux-kernel

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

Hello All
            I have searched for Maintainers List to get the correct
Maintainer for my patch. But i am not getting exact maintainer to
which i should forward my patch. Will any body please tell me,to which
maintainer i should forward my patch for its inclusion?

Summery of the Patch:

This patch Warns the administrator about the fork bombing attack
(whenever any user is crossing its process limit). I have used
printk_ratelimit function in this patch. This function helps to
prevent flooding of syslog and prints message as per the values set by
root user in following files:-

1) /proc/sys/kernel/printk_ratelimit:- This file contains value for,
how many times message should be printed in syslog.

2) /proc/sys/kernel/printk_ratelimit_burst: - This file contains value
for, after how much time message should be repeated.

This patch is really helpful for administrator/root user from security
point of view. They can take action against attacker by looking at
syslog messages related with fork bombing attack.

Added comments will definitely help developers.

Signed-Off-by: Anand Jahagirdar <anandjigar@gmail.com>

[-- Attachment #2: fork.patch --]
[-- Type: text/plain, Size: 1111 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-26 20:40:06.000000000 +0530
+++ 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 crossing the process limit.
+         */
+ 
       	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) 
+				p->user != &root_user)  {
+                        if (printk_ratelimit())
+                                printk(KERN_WARNING "User with uid %u is crossing the process limit\n",p->user->uid);
+
 			 goto bad_fork_free;
-			
+		}			
 			
 	atomic_inc(&p->user->__count);
 	atomic_inc(&p->user->processes);

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <8Alj9-41R-7@gated-at.bofh.it>]
* Patch Related With Fork Bombing Attack
@ 2007-06-26 15:32 Anand Jahagirdar
  0 siblings, 0 replies; 5+ messages in thread
From: Anand Jahagirdar @ 2007-06-26 15:32 UTC (permalink / raw)
  To: linux-kernel, security

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

Hello All
             As per the discussion in the thread with subject as
Patch Related with Fork Bombing Attack on LKML,I have modified my
patch. I request you for the inclusion of my attached patch named
"fork.patch".

Summery of the Patch:

This patch Warns the administrator about the fork bombing attack
(whenever any user is crossing its process limit). I have used
printk_ratelimit function in this patch. This function helps to
prevent flooding of syslog and prints message as per the values set by
root user in following files:-

1) /proc/sys/kernel/printk_ratelimit:- This file contains value for,
how many times message should be printed in syslog.

2) /proc/sys/kernel/printk_ratelimit_burst: - This file contains value
for, after how much time message should be repeated.

This patch is really helpful for administrator/root user from security
point of view. They can take action against attacker by looking at
syslog messages related with fork bombing attack.

Added comments will definitely help developers.

Signed-Off-by: Anand Jahagirdar <anandjigar@gmail.com>

[-- Attachment #2: fork.patch --]
[-- Type: application/octet-stream, Size: 1111 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-26 20:40:06.000000000 +0530
+++ 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 crossing the process limit.
+         */
+ 
       	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) 
+				p->user != &root_user)  {
+                        if (printk_ratelimit())
+                                printk(KERN_WARNING "User with uid %u is crossing the process limit\n",p->user->uid);
+
 			 goto bad_fork_free;
-			
+		}			
 			
 	atomic_inc(&p->user->__count);
 	atomic_inc(&p->user->processes);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-15  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-13 12:39 Patch Related with Fork Bombing Attack Anand Jahagirdar
2007-07-14  9:40 ` WANG Cong
2007-07-15  8:48 ` Simon Arlott
     [not found] <8Alj9-41R-7@gated-at.bofh.it>
2007-06-27 22:14 ` Patch Related With " Bodo Eggert
  -- strict thread matches above, loose matches on Subject: below --
2007-06-26 15:32 Anand Jahagirdar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox