aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-02-13 07:26:26 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-02-13 07:26:26 -0500
commit9fbbd4dd17d0712054368e5e939e28b2456bfe1b (patch)
tree778766e35c52529ed0fc369ce1c3cf9382fc6e16
parent120fad72401ebec2a126c16cc48f56c28f3eefe2 (diff)
[PATCH] x86: Don't require the vDSO for handling a.out signals
and in other strange binfmts. vDSO is not necessarily mapped there. Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r--arch/i386/kernel/signal.c6
-rw-r--r--arch/x86_64/ia32/ia32_signal.c7
-rw-r--r--fs/binfmt_elf.c3
-rw-r--r--include/linux/binfmts.h1
4 files changed, 14 insertions, 3 deletions
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 8f4afcc7d2ab..4f99e870c986 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -21,6 +21,7 @@
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/binfmts.h>
24#include <asm/processor.h> 25#include <asm/processor.h>
25#include <asm/ucontext.h> 26#include <asm/ucontext.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
@@ -349,7 +350,10 @@ static int setup_frame(int sig, struct k_sigaction *ka,
349 goto give_sigsegv; 350 goto give_sigsegv;
350 } 351 }
351 352
352 restorer = (void *)VDSO_SYM(&__kernel_sigreturn); 353 if (current->binfmt->hasvdso)
354 restorer = (void *)VDSO_SYM(&__kernel_sigreturn);
355 else
356 restorer = (void *)&frame->retcode;
353 if (ka->sa.sa_flags & SA_RESTORER) 357 if (ka->sa.sa_flags & SA_RESTORER)
354 restorer = ka->sa.sa_restorer; 358 restorer = ka->sa.sa_restorer;
355 359
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
index 490f7c1b7c84..359eacc38509 100644
--- a/arch/x86_64/ia32/ia32_signal.c
+++ b/arch/x86_64/ia32/ia32_signal.c
@@ -21,6 +21,7 @@
21#include <linux/stddef.h> 21#include <linux/stddef.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/compat.h> 23#include <linux/compat.h>
24#include <linux/binfmts.h>
24#include <asm/ucontext.h> 25#include <asm/ucontext.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/i387.h> 27#include <asm/i387.h>
@@ -449,7 +450,11 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
449 450
450 /* Return stub is in 32bit vsyscall page */ 451 /* Return stub is in 32bit vsyscall page */
451 { 452 {
452 void __user *restorer = VSYSCALL32_SIGRETURN; 453 void __user *restorer;
454 if (current->binfmt->hasvdso)
455 restorer = VSYSCALL32_SIGRETURN;
456 else
457 restorer = (void *)&frame->retcode;
453 if (ka->sa.sa_flags & SA_RESTORER) 458 if (ka->sa.sa_flags & SA_RESTORER)
454 restorer = ka->sa.sa_restorer; 459 restorer = ka->sa.sa_restorer;
455 err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); 460 err |= __put_user(ptr_to_compat(restorer), &frame->pretcode);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 669dbe5b0317..51db1182b27e 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = {
76 .load_binary = load_elf_binary, 76 .load_binary = load_elf_binary,
77 .load_shlib = load_elf_library, 77 .load_shlib = load_elf_library,
78 .core_dump = elf_core_dump, 78 .core_dump = elf_core_dump,
79 .min_coredump = ELF_EXEC_PAGESIZE 79 .min_coredump = ELF_EXEC_PAGESIZE,
80 .hasvdso = 1
80}; 81};
81 82
82#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) 83#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c1e82c514443..2d956cd566ae 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -59,6 +59,7 @@ struct linux_binfmt {
59 int (*load_shlib)(struct file *); 59 int (*load_shlib)(struct file *);
60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); 60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
61 unsigned long min_coredump; /* minimal dump size */ 61 unsigned long min_coredump; /* minimal dump size */
62 int hasvdso;
62}; 63};
63 64
64extern int register_binfmt(struct linux_binfmt *); 65extern int register_binfmt(struct linux_binfmt *);