Commit 9fbbd4dd authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen

[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: default avatarAndi Kleen <ak@suse.de>
parent 120fad72
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/binfmts.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/ucontext.h> #include <asm/ucontext.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -349,7 +350,10 @@ static int setup_frame(int sig, struct k_sigaction *ka, ...@@ -349,7 +350,10 @@ static int setup_frame(int sig, struct k_sigaction *ka,
goto give_sigsegv; goto give_sigsegv;
} }
restorer = (void *)VDSO_SYM(&__kernel_sigreturn); if (current->binfmt->hasvdso)
restorer = (void *)VDSO_SYM(&__kernel_sigreturn);
else
restorer = (void *)&frame->retcode;
if (ka->sa.sa_flags & SA_RESTORER) if (ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ka->sa.sa_restorer;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/binfmts.h>
#include <asm/ucontext.h> #include <asm/ucontext.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/i387.h> #include <asm/i387.h>
...@@ -449,7 +450,11 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -449,7 +450,11 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
/* Return stub is in 32bit vsyscall page */ /* Return stub is in 32bit vsyscall page */
{ {
void __user *restorer = VSYSCALL32_SIGRETURN; void __user *restorer;
if (current->binfmt->hasvdso)
restorer = VSYSCALL32_SIGRETURN;
else
restorer = (void *)&frame->retcode;
if (ka->sa.sa_flags & SA_RESTORER) if (ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ka->sa.sa_restorer;
err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); err |= __put_user(ptr_to_compat(restorer), &frame->pretcode);
......
...@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = { ...@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = {
.load_binary = load_elf_binary, .load_binary = load_elf_binary,
.load_shlib = load_elf_library, .load_shlib = load_elf_library,
.core_dump = elf_core_dump, .core_dump = elf_core_dump,
.min_coredump = ELF_EXEC_PAGESIZE .min_coredump = ELF_EXEC_PAGESIZE,
.hasvdso = 1
}; };
#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
......
...@@ -59,6 +59,7 @@ struct linux_binfmt { ...@@ -59,6 +59,7 @@ struct linux_binfmt {
int (*load_shlib)(struct file *); int (*load_shlib)(struct file *);
int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
unsigned long min_coredump; /* minimal dump size */ unsigned long min_coredump; /* minimal dump size */
int hasvdso;
}; };
extern int register_binfmt(struct linux_binfmt *); extern int register_binfmt(struct linux_binfmt *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment