diff options
| author | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:18:59 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:18:59 -0800 |
| commit | dfc52b82fee5bc6713ecce3f81767a8565c4f874 (patch) | |
| tree | d48688e5ffd92742e5556791c1c8f086317203d5 /kernel | |
| parent | a880f45a48be2956d2c78a839c472287d54435c1 (diff) | |
v2.4.9.11 -> v2.4.9.12
- Alan Cox: much more merging
- Pete Zaitcev: ymfpci race fixes
- Andrea Arkangeli: VM race fix and OOM tweak.
- Arjan Van de Ven: merge RH kernel fixes
- Andi Kleen: use more readable 'likely()/unlikely()' instead of __builtin_expect()
- Keith Owens: fix 64-bit ELF types
- Gerd Knorr: mark more broken PCI bridges, update btaudio driver
- Paul Mackerras: powermac driver update
- me: clean up PTRACE_DETACH to use common infrastructure
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 2 | ||||
| -rw-r--r-- | kernel/ptrace.c | 23 | ||||
| -rw-r--r-- | kernel/sched.c | 14 | ||||
| -rw-r--r-- | kernel/sys.c | 3 | ||||
| -rw-r--r-- | kernel/sysctl.c | 3 |
5 files changed, 36 insertions, 9 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 9179e235dfe5..91aeda9ef591 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -72,7 +72,7 @@ void __init fork_init(unsigned long mempages) * value: the thread structures can take up at most half * of memory. */ - max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 16; + max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8; init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2; init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2; diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 2b95bad07d92..b9cf12d4c02d 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -42,6 +42,8 @@ int ptrace_attach(struct task_struct *task) /* Go */ task->ptrace |= PT_PTRACED; + if (capable(CAP_SYS_PTRACE)) + task->ptrace |= PT_PTRACE_CAP; task_unlock(task); write_lock_irq(&tasklist_lock); @@ -60,6 +62,27 @@ bad: return -EPERM; } +int ptrace_detach(struct task_struct *child, unsigned int data) +{ + if ((unsigned long) data > _NSIG) + return -EIO; + + /* Architecture-specific hardware disable .. */ + ptrace_disable(child); + + /* .. re-parent .. */ + child->ptrace = 0; + child->exit_code = data; + write_lock_irq(&tasklist_lock); + REMOVE_LINKS(child); + child->p_pptr = child->p_opptr; + SET_LINKS(child); + write_unlock_irq(&tasklist_lock); + + /* .. and wake it up. */ + wake_up_process(child); + return 0; +} /* * Access another process' address space, one page at a time. diff --git a/kernel/sched.c b/kernel/sched.c index 3d7c4659bb75..3e209c8c9cc6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -23,6 +23,7 @@ #include <linux/mm.h> #include <linux/init.h> #include <linux/smp_lock.h> +#include <linux/nmi.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <linux/completion.h> @@ -536,6 +537,7 @@ asmlinkage void schedule(void) struct list_head *tmp; int this_cpu, c; + spin_lock_prefetch(&runqueue_lock); if (!current->active_mm) BUG(); @@ -723,18 +725,16 @@ scheduling_in_interrupt: static inline void __wake_up_common (wait_queue_head_t *q, unsigned int mode, int nr_exclusive, const int sync) { - struct list_head *tmp, *head; + struct list_head *tmp; struct task_struct *p; CHECK_MAGIC_WQHEAD(q); - head = &q->task_list; - WQ_CHECK_LIST_HEAD(head); - tmp = head->next; - while (tmp != head) { + WQ_CHECK_LIST_HEAD(&q->task_list); + + list_for_each(tmp,&q->task_list) { unsigned int state; wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); - tmp = tmp->next; CHECK_MAGIC(curr->__magic); p = curr->task; state = p->state; @@ -1054,7 +1054,7 @@ asmlinkage long sys_sched_yield(void) #if CONFIG_SMP int i; - // Substract non-idle processes running on other CPUs. + // Subtract non-idle processes running on other CPUs. for (i = 0; i < smp_num_cpus; i++) { int cpu = cpu_logical_map(i); if (aligned_data[cpu].schedule_data.curr != idle_task(cpu)) diff --git a/kernel/sys.c b/kernel/sys.c index 6506490a9357..765761a4e71b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -39,6 +39,7 @@ int fs_overflowgid = DEFAULT_FS_OVERFLOWUID; */ int C_A_D = 1; +int cad_pid = 1; /* @@ -350,7 +351,7 @@ void ctrl_alt_del(void) if (C_A_D) schedule_task(&cad_tq); else - kill_proc(1, SIGINT, 1); + kill_proc(cad_pid, SIGINT, 1); } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index af54f02302b7..3378b95d209c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -48,6 +48,7 @@ extern int max_threads; extern int nr_queued_signals, max_queued_signals; extern int sysrq_enabled; extern int core_uses_pid; +extern int cad_pid; /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid = 65535; @@ -233,6 +234,8 @@ static ctl_table kern_table[] = { {KERN_SYSRQ, "sysrq", &sysrq_enabled, sizeof (int), 0644, NULL, &proc_dointvec}, #endif + {KERN_CADPID, "cad_pid", &cad_pid, sizeof (int), + 0600, NULL, &proc_dointvec}, {KERN_MAX_THREADS, "threads-max", &max_threads, sizeof(int), 0644, NULL, &proc_dointvec}, {KERN_RANDOM, "random", NULL, 0, 0555, random_table}, |
