aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-08 07:19:28 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:30 -0500
commit7fa3031500ec9b0a7460c8c23751799006ffee74 (patch)
tree2a7e9202b35a39dc8217e95825263c0629e67e35 /arch
parentb0b933c08bd5fd053bbba8ba6387f543be03d49f (diff)
aout: suppress A.OUT library support if !CONFIG_ARCH_SUPPORTS_AOUT
Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set. Not all architectures support the A.OUT binfmt, so the ELF binfmt should not be permitted to go looking for A.OUT libraries to load in such a case. Not only that, but under such conditions A.OUT core dumps are not produced either. To make this work, this patch also does the following: (1) Makes the existence of the contents of linux/a.out.h contingent on CONFIG_ARCH_SUPPORTS_AOUT. (2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT core dumping code. (3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline. This is then included only where needed. This means that this bit of arch code will be stored in the appropriate A.OUT binfmt module rather than the core kernel. (4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not needed) and FRV. This patch depends on the previous patch to move STACK_TOP[_MAX] out of asm/a.out.h and into asm/processor.h as they're required whether or not A.OUT format is available. [jdike@addtoit.com: uml: re-remove accidentally restored code] Signed-off-by: David Howells <dhowells@redhat.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/process.c62
-rw-r--r--arch/arm/kernel/process.c29
-rw-r--r--arch/m68k/kernel/process.c47
-rw-r--r--arch/sparc/kernel/process.c32
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c2
-rw-r--r--arch/sparc64/kernel/binfmt_aout32.c3
-rw-r--r--arch/sparc64/kernel/process.c11
-rw-r--r--arch/um/kernel/ksyms.c1
-rw-r--r--arch/um/kernel/process.c4
-rw-r--r--arch/x86/kernel/process_32.c49
10 files changed, 2 insertions, 238 deletions
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 92b61629fe3f..9aed47763787 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -318,68 +318,6 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
318} 318}
319 319
320/* 320/*
321 * Fill in the user structure for an ECOFF core dump.
322 */
323void
324dump_thread(struct pt_regs * pt, struct user * dump)
325{
326 /* switch stack follows right below pt_regs: */
327 struct switch_stack * sw = ((struct switch_stack *) pt) - 1;
328
329 dump->magic = CMAGIC;
330 dump->start_code = current->mm->start_code;
331 dump->start_data = current->mm->start_data;
332 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
333 dump->u_tsize = ((current->mm->end_code - dump->start_code)
334 >> PAGE_SHIFT);
335 dump->u_dsize = ((current->mm->brk + PAGE_SIZE-1 - dump->start_data)
336 >> PAGE_SHIFT);
337 dump->u_ssize = (current->mm->start_stack - dump->start_stack
338 + PAGE_SIZE-1) >> PAGE_SHIFT;
339
340 /*
341 * We store the registers in an order/format that is
342 * compatible with DEC Unix/OSF/1 as this makes life easier
343 * for gdb.
344 */
345 dump->regs[EF_V0] = pt->r0;
346 dump->regs[EF_T0] = pt->r1;
347 dump->regs[EF_T1] = pt->r2;
348 dump->regs[EF_T2] = pt->r3;
349 dump->regs[EF_T3] = pt->r4;
350 dump->regs[EF_T4] = pt->r5;
351 dump->regs[EF_T5] = pt->r6;
352 dump->regs[EF_T6] = pt->r7;
353 dump->regs[EF_T7] = pt->r8;
354 dump->regs[EF_S0] = sw->r9;
355 dump->regs[EF_S1] = sw->r10;
356 dump->regs[EF_S2] = sw->r11;
357 dump->regs[EF_S3] = sw->r12;
358 dump->regs[EF_S4] = sw->r13;
359 dump->regs[EF_S5] = sw->r14;
360 dump->regs[EF_S6] = sw->r15;
361 dump->regs[EF_A3] = pt->r19;
362 dump->regs[EF_A4] = pt->r20;
363 dump->regs[EF_A5] = pt->r21;
364 dump->regs[EF_T8] = pt->r22;
365 dump->regs[EF_T9] = pt->r23;
366 dump->regs[EF_T10] = pt->r24;
367 dump->regs[EF_T11] = pt->r25;
368 dump->regs[EF_RA] = pt->r26;
369 dump->regs[EF_T12] = pt->r27;
370 dump->regs[EF_AT] = pt->r28;
371 dump->regs[EF_SP] = rdusp();
372 dump->regs[EF_PS] = pt->ps;
373 dump->regs[EF_PC] = pt->pc;
374 dump->regs[EF_GP] = pt->gp;
375 dump->regs[EF_A0] = pt->r16;
376 dump->regs[EF_A1] = pt->r17;
377 dump->regs[EF_A2] = pt->r18;
378 memcpy((char *)dump->regs + EF_SIZE, sw->fp, 32 * 8);
379}
380EXPORT_SYMBOL(dump_thread);
381
382/*
383 * Fill in the user structure for a ELF core dump. 321 * Fill in the user structure for a ELF core dump.
384 */ 322 */
385void 323void
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 4f1a03124a74..436380a5f4c7 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -368,35 +368,6 @@ int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
368EXPORT_SYMBOL(dump_fpu); 368EXPORT_SYMBOL(dump_fpu);
369 369
370/* 370/*
371 * fill in the user structure for a core dump..
372 */
373void dump_thread(struct pt_regs * regs, struct user * dump)
374{
375 struct task_struct *tsk = current;
376
377 dump->magic = CMAGIC;
378 dump->start_code = tsk->mm->start_code;
379 dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
380
381 dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
382 dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
383 dump->u_ssize = 0;
384
385 dump->u_debugreg[0] = tsk->thread.debug.bp[0].address;
386 dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
387 dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn.arm;
388 dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn.arm;
389 dump->u_debugreg[4] = tsk->thread.debug.nsaved;
390
391 if (dump->start_stack < 0x04000000)
392 dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
393
394 dump->regs = *regs;
395 dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
396}
397EXPORT_SYMBOL(dump_thread);
398
399/*
400 * Shuffle the argument into the correct register before calling the 371 * Shuffle the argument into the correct register before calling the
401 * thread function. r1 is the thread argument, r2 is the pointer to 372 * thread function. r1 is the thread argument, r2 is the pointer to
402 * the thread function, and r3 points to the exit function. 373 * the thread function, and r3 points to the exit function.
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index f85b928ffac4..5f45567318df 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -316,53 +316,6 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
316EXPORT_SYMBOL(dump_fpu); 316EXPORT_SYMBOL(dump_fpu);
317 317
318/* 318/*
319 * fill in the user structure for a core dump..
320 */
321void dump_thread(struct pt_regs * regs, struct user * dump)
322{
323 struct switch_stack *sw;
324
325/* changed the size calculations - should hopefully work better. lbt */
326 dump->magic = CMAGIC;
327 dump->start_code = 0;
328 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
329 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
330 dump->u_dsize = ((unsigned long) (current->mm->brk +
331 (PAGE_SIZE-1))) >> PAGE_SHIFT;
332 dump->u_dsize -= dump->u_tsize;
333 dump->u_ssize = 0;
334
335 if (dump->start_stack < TASK_SIZE)
336 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
337
338 dump->u_ar0 = offsetof(struct user, regs);
339 sw = ((struct switch_stack *)regs) - 1;
340 dump->regs.d1 = regs->d1;
341 dump->regs.d2 = regs->d2;
342 dump->regs.d3 = regs->d3;
343 dump->regs.d4 = regs->d4;
344 dump->regs.d5 = regs->d5;
345 dump->regs.d6 = sw->d6;
346 dump->regs.d7 = sw->d7;
347 dump->regs.a0 = regs->a0;
348 dump->regs.a1 = regs->a1;
349 dump->regs.a2 = regs->a2;
350 dump->regs.a3 = sw->a3;
351 dump->regs.a4 = sw->a4;
352 dump->regs.a5 = sw->a5;
353 dump->regs.a6 = sw->a6;
354 dump->regs.d0 = regs->d0;
355 dump->regs.orig_d0 = regs->orig_d0;
356 dump->regs.stkadj = regs->stkadj;
357 dump->regs.sr = regs->sr;
358 dump->regs.pc = regs->pc;
359 dump->regs.fmtvec = (regs->format << 12) | regs->vector;
360 /* dump floating point stuff */
361 dump->u_fpvalid = dump_fpu (regs, &dump->m68kfp);
362}
363EXPORT_SYMBOL(dump_thread);
364
365/*
366 * sys_execve() executes a new program. 319 * sys_execve() executes a new program.
367 */ 320 */
368asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp) 321asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 77460e316a03..a248e81caa0e 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -567,38 +567,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
567} 567}
568 568
569/* 569/*
570 * fill in the user structure for a core dump..
571 */
572void dump_thread(struct pt_regs * regs, struct user * dump)
573{
574 unsigned long first_stack_page;
575
576 dump->magic = SUNOS_CORE_MAGIC;
577 dump->len = sizeof(struct user);
578 dump->regs.psr = regs->psr;
579 dump->regs.pc = regs->pc;
580 dump->regs.npc = regs->npc;
581 dump->regs.y = regs->y;
582 /* fuck me plenty */
583 memcpy(&dump->regs.regs[0], &regs->u_regs[1], (sizeof(unsigned long) * 15));
584 dump->uexec = current->thread.core_exec;
585 dump->u_tsize = (((unsigned long) current->mm->end_code) -
586 ((unsigned long) current->mm->start_code)) & ~(PAGE_SIZE - 1);
587 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1)));
588 dump->u_dsize -= dump->u_tsize;
589 dump->u_dsize &= ~(PAGE_SIZE - 1);
590 first_stack_page = (regs->u_regs[UREG_FP] & ~(PAGE_SIZE - 1));
591 dump->u_ssize = (TASK_SIZE - first_stack_page) & ~(PAGE_SIZE - 1);
592 memcpy(&dump->fpu.fpstatus.fregs.regs[0], &current->thread.float_regs[0], (sizeof(unsigned long) * 32));
593 dump->fpu.fpstatus.fsr = current->thread.fsr;
594 dump->fpu.fpstatus.flags = dump->fpu.fpstatus.extra = 0;
595 dump->fpu.fpstatus.fpq_count = current->thread.fpqdepth;
596 memcpy(&dump->fpu.fpstatus.fpq[0], &current->thread.fpqueue[0],
597 ((sizeof(unsigned long) * 2) * 16));
598 dump->sigcode = 0;
599}
600
601/*
602 * fill in the fpu structure for a core dump. 570 * fill in the fpu structure for a core dump.
603 */ 571 */
604int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) 572int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index ef647acc479e..62f6221db74f 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -214,8 +214,6 @@ EXPORT_SYMBOL(kunmap_atomic);
214EXPORT_SYMBOL(svr4_setcontext); 214EXPORT_SYMBOL(svr4_setcontext);
215EXPORT_SYMBOL(svr4_getcontext); 215EXPORT_SYMBOL(svr4_getcontext);
216 216
217EXPORT_SYMBOL(dump_thread);
218
219/* prom symbols */ 217/* prom symbols */
220EXPORT_SYMBOL(idprom); 218EXPORT_SYMBOL(idprom);
221EXPORT_SYMBOL(prom_root_node); 219EXPORT_SYMBOL(prom_root_node);
diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c
index 92c1b36a2e16..9877f2d7672d 100644
--- a/arch/sparc64/kernel/binfmt_aout32.c
+++ b/arch/sparc64/kernel/binfmt_aout32.c
@@ -32,6 +32,7 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
34#include <asm/mmu_context.h> 34#include <asm/mmu_context.h>
35#include <asm/a.out-core.h>
35 36
36static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs); 37static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs);
37static int load_aout32_library(struct file*); 38static int load_aout32_library(struct file*);
@@ -101,7 +102,7 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file,
101 current->flags |= PF_DUMPCORE; 102 current->flags |= PF_DUMPCORE;
102 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm)); 103 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
103 dump.signal = signr; 104 dump.signal = signr;
104 dump_thread(regs, &dump); 105 aout_dump_thread(regs, &dump);
105 106
106/* If the size of the dump file exceeds the rlimit, then see what would happen 107/* If the size of the dump file exceeds the rlimit, then see what would happen
107 if we wrote the stack, but not the data area. */ 108 if we wrote the stack, but not the data area. */
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index ca7cdfd55f72..6e21785bb36d 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -725,17 +725,6 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
725 return retval; 725 return retval;
726} 726}
727 727
728/*
729 * fill in the user structure for a core dump..
730 */
731void dump_thread(struct pt_regs * regs, struct user * dump)
732{
733 /* Only should be used for SunOS and ancient a.out
734 * SparcLinux binaries... Not worth implementing.
735 */
736 memset(dump, 0, sizeof(struct user));
737}
738
739typedef struct { 728typedef struct {
740 union { 729 union {
741 unsigned int pr_regs[32]; 730 unsigned int pr_regs[32];
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index 5311ee93ede3..19ce9dbf46c3 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -60,7 +60,6 @@ EXPORT_SYMBOL(os_accept_connection);
60EXPORT_SYMBOL(os_rcv_fd); 60EXPORT_SYMBOL(os_rcv_fd);
61EXPORT_SYMBOL(run_helper); 61EXPORT_SYMBOL(run_helper);
62EXPORT_SYMBOL(start_thread); 62EXPORT_SYMBOL(start_thread);
63EXPORT_SYMBOL(dump_thread);
64 63
65#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
66 65
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index c07961bedb75..fc50d2f959d1 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -258,10 +258,6 @@ void cpu_idle(void)
258 default_idle(); 258 default_idle();
259} 259}
260 260
261void dump_thread(struct pt_regs *regs, struct user *u)
262{
263}
264
265int __cant_sleep(void) { 261int __cant_sleep(void) {
266 return in_atomic() || irqs_disabled() || in_interrupt(); 262 return in_atomic() || irqs_disabled() || in_interrupt();
267 /* Is in_interrupt() really needed? */ 263 /* Is in_interrupt() really needed? */
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index dabdbeff1f77..78858068e24d 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -539,55 +539,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
539 return err; 539 return err;
540} 540}
541 541
542/*
543 * fill in the user structure for a core dump..
544 */
545void dump_thread(struct pt_regs * regs, struct user * dump)
546{
547 u16 gs;
548
549/* changed the size calculations - should hopefully work better. lbt */
550 dump->magic = CMAGIC;
551 dump->start_code = 0;
552 dump->start_stack = regs->sp & ~(PAGE_SIZE - 1);
553 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
554 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
555 dump->u_dsize -= dump->u_tsize;
556 dump->u_ssize = 0;
557 dump->u_debugreg[0] = current->thread.debugreg0;
558 dump->u_debugreg[1] = current->thread.debugreg1;
559 dump->u_debugreg[2] = current->thread.debugreg2;
560 dump->u_debugreg[3] = current->thread.debugreg3;
561 dump->u_debugreg[4] = 0;
562 dump->u_debugreg[5] = 0;
563 dump->u_debugreg[6] = current->thread.debugreg6;
564 dump->u_debugreg[7] = current->thread.debugreg7;
565
566 if (dump->start_stack < TASK_SIZE)
567 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
568
569 dump->regs.bx = regs->bx;
570 dump->regs.cx = regs->cx;
571 dump->regs.dx = regs->dx;
572 dump->regs.si = regs->si;
573 dump->regs.di = regs->di;
574 dump->regs.bp = regs->bp;
575 dump->regs.ax = regs->ax;
576 dump->regs.ds = (u16)regs->ds;
577 dump->regs.es = (u16)regs->es;
578 dump->regs.fs = (u16)regs->fs;
579 savesegment(gs,gs);
580 dump->regs.orig_ax = regs->orig_ax;
581 dump->regs.ip = regs->ip;
582 dump->regs.cs = (u16)regs->cs;
583 dump->regs.flags = regs->flags;
584 dump->regs.sp = regs->sp;
585 dump->regs.ss = (u16)regs->ss;
586
587 dump->u_fpvalid = dump_fpu (regs, &dump->i387);
588}
589EXPORT_SYMBOL(dump_thread);
590
591#ifdef CONFIG_SECCOMP 542#ifdef CONFIG_SECCOMP
592static void hard_disable_TSC(void) 543static void hard_disable_TSC(void)
593{ 544{