All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] threads_max: Simple lockout prevention patch
@ 2005-11-14 20:27 Al Boldi
  2006-01-30 13:21 ` Al Boldi
  0 siblings, 1 reply; 16+ messages in thread
From: Al Boldi @ 2005-11-14 20:27 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel


Simple attempt to provide a backdoor in a process lockout situation.

echo $$ > /proc/sys/kernel/su-pid allows pid to exceed the threads_max limit.

Signed-off-by: Al Boldi <a1426z@gawab.com>

---
(patch against 2.6.14)

--- kernel/fork.c.orig  2005-11-14 20:55:33.000000000 +0300
+++ kernel/fork.c       2005-11-14 20:58:25.000000000 +0300
@@ -57,6 +57,7 @@
 int nr_threads;                /* The idle threads do not count.. */
 
 int max_threads;               /* tunable limit on nr_threads */
+int su_pid;                    /* BackDoor pid to exceed limit on nr_threads 
*/
 
 DEFINE_PER_CPU(unsigned long, process_counts) = 0;
 
@@ -926,6 +927,7 @@
         * to stop root fork bombs.
         */
        if (nr_threads >= max_threads)
+       if (p->pid != su_pid)
                goto bad_fork_cleanup_count;
 
        if (!try_module_get(p->thread_info->exec_domain->module))


--- kernel/sysctl.c.orig        2005-11-14 20:58:45.000000000 +0300
+++ kernel/sysctl.c     2005-11-14 21:01:20.000000000 +0300
@@ -57,6 +57,7 @@
 extern int sysctl_overcommit_memory;
 extern int sysctl_overcommit_ratio;
 extern int max_threads;
+extern int su_pid;
 extern int sysrq_enabled;
 extern int core_uses_pid;
 extern int suid_dumpable;
@@ -509,6 +510,14 @@
                .proc_handler   = &proc_dointvec,
        },
        {
+               .ctl_name       = KERN_SU_PID,
+               .procname       = "su-pid",
+               .data           = &su_pid,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+       {
                .ctl_name       = KERN_RANDOM,
                .procname       = "random",
                .mode           = 0555,


--- include/linux/sysctl.h.orig 2005-11-14 20:54:55.000000000 +0300
+++ include/linux/sysctl.h      2005-11-14 20:55:15.000000000 +0300
@@ -146,6 +146,7 @@
        KERN_RANDOMIZE=68, /* int: randomize virtual address space */
        KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core 
*/
        KERN_SPIN_RETRY=70,     /* int: number of spinlock retries */
+       KERN_SU_PID=71, /* int: BackDoor pid to exceed Maximum nr of threads 
in the system */
 };



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

end of thread, other threads:[~2006-04-28 17:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-14 20:27 [PATCH 1/1] threads_max: Simple lockout prevention patch Al Boldi
2006-01-30 13:21 ` Al Boldi
2006-04-24  4:56   ` Al Boldi
2006-04-24  5:11     ` Andrew Morton
2006-04-24 11:12       ` Al Boldi
2006-04-24 11:22         ` Pekka Enberg
2006-04-24 13:53           ` Al Boldi
2006-04-24 14:11             ` Pekka Enberg
2006-04-24 14:46               ` Al Boldi
2006-04-24 16:32                 ` Pekka Enberg
2006-04-24 11:24         ` Nick Piggin
2006-04-24 13:37           ` Al Boldi
2006-04-25  7:23             ` Nick Piggin
2006-04-25 10:44               ` Al Boldi
2006-04-28 16:58         ` Al Boldi
2006-04-24  7:10     ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.