sparc: Remove old style signal frame support.
Back around the same time we were bootstrapping the first 32-bit sparc Linux kernel with a SunOS userland, we made the signal frame match that of SunOS. By the time we even started putting together a native Linux userland for 32-bit Sparc we realized this layout wasn't sufficient for Linux's needs. Therefore we changed the layout, yet kept support for the old style signal frame layout in there. The detection mechanism is that we had sys_sigaction() start passing in a negative signal number to indicate "new style signal frames please". Anyways, no binaries exist in the world that use the old stuff. In fact, I bet Jakub Jelinek and myself are the only two people who ever had such binaries to be honest. So let's get rid of this stuff. I added an assertion using WARN_ON_ONCE() that makes sure 32-bit applications are passing in that negative signal number still. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7cf069955f
commit
5526b7e451
@ -357,8 +357,6 @@ void flush_thread(void)
|
||||
{
|
||||
current_thread_info()->w_saved = 0;
|
||||
|
||||
/* No new signal delivery by default */
|
||||
current->thread.new_signal = 0;
|
||||
#ifndef CONFIG_SMP
|
||||
if(last_task_used_math == current) {
|
||||
#else
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: signal.c,v 1.110 2002/02/08 03:57:14 davem Exp $
|
||||
* linux/arch/sparc/kernel/signal.c
|
||||
/* linux/arch/sparc/kernel/signal.c
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
@ -32,37 +31,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
|
||||
void *fpqueue, unsigned long *fpqdepth);
|
||||
extern void fpload(unsigned long *fpregs, unsigned long *fsr);
|
||||
|
||||
/* Signal frames: the original one (compatible with SunOS):
|
||||
*
|
||||
* Set up a signal frame... Make the stack look the way SunOS
|
||||
* expects it to look which is basically:
|
||||
*
|
||||
* ---------------------------------- <-- %sp at signal time
|
||||
* Struct sigcontext
|
||||
* Signal address
|
||||
* Ptr to sigcontext area above
|
||||
* Signal code
|
||||
* The signal number itself
|
||||
* One register window
|
||||
* ---------------------------------- <-- New %sp
|
||||
*/
|
||||
struct signal_sframe {
|
||||
struct reg_window sig_window;
|
||||
int sig_num;
|
||||
int sig_code;
|
||||
struct sigcontext __user *sig_scptr;
|
||||
int sig_address;
|
||||
struct sigcontext sig_context;
|
||||
unsigned int extramask[_NSIG_WORDS - 1];
|
||||
};
|
||||
|
||||
/*
|
||||
* And the new one, intended to be used for Linux applications only
|
||||
* (we have enough in there to work with clone).
|
||||
* All the interesting bits are in the info field.
|
||||
*/
|
||||
|
||||
struct new_signal_frame {
|
||||
struct signal_frame {
|
||||
struct sparc_stackf ss;
|
||||
__siginfo_t info;
|
||||
__siginfo_fpu_t __user *fpu_save;
|
||||
@ -85,8 +54,7 @@ struct rt_signal_frame {
|
||||
};
|
||||
|
||||
/* Align macros */
|
||||
#define SF_ALIGNEDSZ (((sizeof(struct signal_sframe) + 7) & (~7)))
|
||||
#define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame) + 7) & (~7)))
|
||||
#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7)))
|
||||
#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7)))
|
||||
|
||||
static int _sigpause_common(old_sigset_t set)
|
||||
@ -141,15 +109,20 @@ restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline void do_new_sigreturn (struct pt_regs *regs)
|
||||
asmlinkage void do_sigreturn(struct pt_regs *regs)
|
||||
{
|
||||
struct new_signal_frame __user *sf;
|
||||
struct signal_frame __user *sf;
|
||||
unsigned long up_psr, pc, npc;
|
||||
sigset_t set;
|
||||
__siginfo_fpu_t __user *fpu_save;
|
||||
int err;
|
||||
|
||||
sf = (struct new_signal_frame __user *) regs->u_regs[UREG_FP];
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
synchronize_user_stack();
|
||||
|
||||
sf = (struct signal_frame __user *) regs->u_regs[UREG_FP];
|
||||
|
||||
/* 1. Make sure we are not getting garbage from the user */
|
||||
if (!access_ok(VERIFY_READ, sf, sizeof(*sf)))
|
||||
@ -198,73 +171,6 @@ segv_and_exit:
|
||||
force_sig(SIGSEGV, current);
|
||||
}
|
||||
|
||||
asmlinkage void do_sigreturn(struct pt_regs *regs)
|
||||
{
|
||||
struct sigcontext __user *scptr;
|
||||
unsigned long pc, npc, psr;
|
||||
sigset_t set;
|
||||
int err;
|
||||
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
synchronize_user_stack();
|
||||
|
||||
if (current->thread.new_signal) {
|
||||
do_new_sigreturn(regs);
|
||||
return;
|
||||
}
|
||||
|
||||
scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0];
|
||||
|
||||
/* Check sanity of the user arg. */
|
||||
if (!access_ok(VERIFY_READ, scptr, sizeof(struct sigcontext)) ||
|
||||
(((unsigned long) scptr) & 3))
|
||||
goto segv_and_exit;
|
||||
|
||||
err = __get_user(pc, &scptr->sigc_pc);
|
||||
err |= __get_user(npc, &scptr->sigc_npc);
|
||||
|
||||
if ((pc | npc) & 3)
|
||||
goto segv_and_exit;
|
||||
|
||||
/* This is pretty much atomic, no amount locking would prevent
|
||||
* the races which exist anyways.
|
||||
*/
|
||||
err |= __get_user(set.sig[0], &scptr->sigc_mask);
|
||||
/* Note that scptr + 1 points to extramask */
|
||||
err |= __copy_from_user(&set.sig[1], scptr + 1,
|
||||
(_NSIG_WORDS - 1) * sizeof(unsigned int));
|
||||
|
||||
if (err)
|
||||
goto segv_and_exit;
|
||||
|
||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
current->blocked = set;
|
||||
recalc_sigpending();
|
||||
spin_unlock_irq(¤t->sighand->siglock);
|
||||
|
||||
regs->pc = pc;
|
||||
regs->npc = npc;
|
||||
|
||||
err = __get_user(regs->u_regs[UREG_FP], &scptr->sigc_sp);
|
||||
err |= __get_user(regs->u_regs[UREG_I0], &scptr->sigc_o0);
|
||||
err |= __get_user(regs->u_regs[UREG_G1], &scptr->sigc_g1);
|
||||
|
||||
/* User can only change condition codes in %psr. */
|
||||
err |= __get_user(psr, &scptr->sigc_psr);
|
||||
if (err)
|
||||
goto segv_and_exit;
|
||||
|
||||
regs->psr &= ~(PSR_ICC);
|
||||
regs->psr |= (psr & PSR_ICC);
|
||||
return;
|
||||
|
||||
segv_and_exit:
|
||||
force_sig(SIGSEGV, current);
|
||||
}
|
||||
|
||||
asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
|
||||
{
|
||||
struct rt_signal_frame __user *sf;
|
||||
@ -351,128 +257,6 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
|
||||
return (void __user *)(sp - framesize);
|
||||
}
|
||||
|
||||
static inline void
|
||||
setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *oldset, siginfo_t *info)
|
||||
{
|
||||
struct signal_sframe __user *sframep;
|
||||
struct sigcontext __user *sc;
|
||||
int window = 0, err;
|
||||
unsigned long pc = regs->pc;
|
||||
unsigned long npc = regs->npc;
|
||||
struct thread_info *tp = current_thread_info();
|
||||
void __user *sig_address;
|
||||
int sig_code;
|
||||
|
||||
synchronize_user_stack();
|
||||
sframep = (struct signal_sframe __user *)
|
||||
get_sigframe(sa, regs, SF_ALIGNEDSZ);
|
||||
if (invalid_frame_pointer(sframep, sizeof(*sframep))){
|
||||
/* Don't change signal code and address, so that
|
||||
* post mortem debuggers can have a look.
|
||||
*/
|
||||
goto sigill_and_return;
|
||||
}
|
||||
|
||||
sc = &sframep->sig_context;
|
||||
|
||||
/* We've already made sure frame pointer isn't in kernel space... */
|
||||
err = __put_user((sas_ss_flags(regs->u_regs[UREG_FP]) == SS_ONSTACK),
|
||||
&sc->sigc_onstack);
|
||||
err |= __put_user(oldset->sig[0], &sc->sigc_mask);
|
||||
err |= __copy_to_user(sframep->extramask, &oldset->sig[1],
|
||||
(_NSIG_WORDS - 1) * sizeof(unsigned int));
|
||||
err |= __put_user(regs->u_regs[UREG_FP], &sc->sigc_sp);
|
||||
err |= __put_user(pc, &sc->sigc_pc);
|
||||
err |= __put_user(npc, &sc->sigc_npc);
|
||||
err |= __put_user(regs->psr, &sc->sigc_psr);
|
||||
err |= __put_user(regs->u_regs[UREG_G1], &sc->sigc_g1);
|
||||
err |= __put_user(regs->u_regs[UREG_I0], &sc->sigc_o0);
|
||||
err |= __put_user(tp->w_saved, &sc->sigc_oswins);
|
||||
if (tp->w_saved)
|
||||
for (window = 0; window < tp->w_saved; window++) {
|
||||
put_user((char *)tp->rwbuf_stkptrs[window],
|
||||
&sc->sigc_spbuf[window]);
|
||||
err |= __copy_to_user(&sc->sigc_wbuf[window],
|
||||
&tp->reg_window[window],
|
||||
sizeof(struct reg_window));
|
||||
}
|
||||
else
|
||||
err |= __copy_to_user(sframep, (char *) regs->u_regs[UREG_FP],
|
||||
sizeof(struct reg_window));
|
||||
|
||||
tp->w_saved = 0; /* So process is allowed to execute. */
|
||||
|
||||
err |= __put_user(signr, &sframep->sig_num);
|
||||
sig_address = NULL;
|
||||
sig_code = 0;
|
||||
if (SI_FROMKERNEL (info) && (info->si_code & __SI_MASK) == __SI_FAULT) {
|
||||
sig_address = info->si_addr;
|
||||
switch (signr) {
|
||||
case SIGSEGV:
|
||||
switch (info->si_code) {
|
||||
case SEGV_MAPERR: sig_code = SUBSIG_NOMAPPING; break;
|
||||
default: sig_code = SUBSIG_PROTECTION; break;
|
||||
}
|
||||
break;
|
||||
case SIGILL:
|
||||
switch (info->si_code) {
|
||||
case ILL_ILLOPC: sig_code = SUBSIG_ILLINST; break;
|
||||
case ILL_PRVOPC: sig_code = SUBSIG_PRIVINST; break;
|
||||
case ILL_ILLTRP: sig_code = SUBSIG_BADTRAP(info->si_trapno); break;
|
||||
default: sig_code = SUBSIG_STACK; break;
|
||||
}
|
||||
break;
|
||||
case SIGFPE:
|
||||
switch (info->si_code) {
|
||||
case FPE_INTDIV: sig_code = SUBSIG_IDIVZERO; break;
|
||||
case FPE_INTOVF: sig_code = SUBSIG_FPINTOVFL; break;
|
||||
case FPE_FLTDIV: sig_code = SUBSIG_FPDIVZERO; break;
|
||||
case FPE_FLTOVF: sig_code = SUBSIG_FPOVFLOW; break;
|
||||
case FPE_FLTUND: sig_code = SUBSIG_FPUNFLOW; break;
|
||||
case FPE_FLTRES: sig_code = SUBSIG_FPINEXACT; break;
|
||||
case FPE_FLTINV: sig_code = SUBSIG_FPOPERROR; break;
|
||||
default: sig_code = SUBSIG_FPERROR; break;
|
||||
}
|
||||
break;
|
||||
case SIGBUS:
|
||||
switch (info->si_code) {
|
||||
case BUS_ADRALN: sig_code = SUBSIG_ALIGNMENT; break;
|
||||
case BUS_ADRERR: sig_code = SUBSIG_MISCERROR; break;
|
||||
default: sig_code = SUBSIG_BUSTIMEOUT; break;
|
||||
}
|
||||
break;
|
||||
case SIGEMT:
|
||||
switch (info->si_code) {
|
||||
case EMT_TAGOVF: sig_code = SUBSIG_TAG; break;
|
||||
}
|
||||
break;
|
||||
case SIGSYS:
|
||||
if (info->si_code == (__SI_FAULT|0x100)) {
|
||||
sig_code = info->si_trapno;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sig_address = NULL;
|
||||
}
|
||||
}
|
||||
err |= __put_user((unsigned long)sig_address, &sframep->sig_address);
|
||||
err |= __put_user(sig_code, &sframep->sig_code);
|
||||
err |= __put_user(sc, &sframep->sig_scptr);
|
||||
if (err)
|
||||
goto sigsegv;
|
||||
|
||||
regs->u_regs[UREG_FP] = (unsigned long) sframep;
|
||||
regs->pc = (unsigned long) sa->sa_handler;
|
||||
regs->npc = (regs->pc + 4);
|
||||
return;
|
||||
|
||||
sigill_and_return:
|
||||
do_exit(SIGILL);
|
||||
sigsegv:
|
||||
force_sigsegv(signr, current);
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
|
||||
{
|
||||
@ -508,21 +292,20 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline void
|
||||
new_setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset)
|
||||
static void setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset)
|
||||
{
|
||||
struct new_signal_frame __user *sf;
|
||||
struct signal_frame __user *sf;
|
||||
int sigframe_size, err;
|
||||
|
||||
/* 1. Make sure everything is clean */
|
||||
synchronize_user_stack();
|
||||
|
||||
sigframe_size = NF_ALIGNEDSZ;
|
||||
sigframe_size = SF_ALIGNEDSZ;
|
||||
if (!used_math())
|
||||
sigframe_size -= sizeof(__siginfo_fpu_t);
|
||||
|
||||
sf = (struct new_signal_frame __user *)
|
||||
sf = (struct signal_frame __user *)
|
||||
get_sigframe(&ka->sa, regs, sigframe_size);
|
||||
|
||||
if (invalid_frame_pointer(sf, sigframe_size))
|
||||
@ -586,9 +369,8 @@ sigsegv:
|
||||
force_sigsegv(signo, current);
|
||||
}
|
||||
|
||||
static inline void
|
||||
new_setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset, siginfo_t *info)
|
||||
static void setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset, siginfo_t *info)
|
||||
{
|
||||
struct rt_signal_frame __user *sf;
|
||||
int sigframe_size;
|
||||
@ -674,11 +456,9 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
|
||||
siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
|
||||
{
|
||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
||||
new_setup_rt_frame(ka, regs, signr, oldset, info);
|
||||
else if (current->thread.new_signal)
|
||||
new_setup_frame(ka, regs, signr, oldset);
|
||||
setup_rt_frame(ka, regs, signr, oldset, info);
|
||||
else
|
||||
setup_frame(&ka->sa, regs, signr, oldset, info);
|
||||
setup_frame(ka, regs, signr, oldset);
|
||||
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: sys_sparc.c,v 1.70 2001/04/14 01:12:02 davem Exp $
|
||||
* linux/arch/sparc/kernel/sys_sparc.c
|
||||
/* linux/arch/sparc/kernel/sys_sparc.c
|
||||
*
|
||||
* This file contains various random system calls that
|
||||
* have a non-standard calling sequence on the Linux/sparc
|
||||
@ -395,10 +394,8 @@ sparc_sigaction (int sig, const struct old_sigaction __user *act,
|
||||
struct k_sigaction new_ka, old_ka;
|
||||
int ret;
|
||||
|
||||
if (sig < 0) {
|
||||
current->thread.new_signal = 1;
|
||||
sig = -sig;
|
||||
}
|
||||
WARN_ON_ONCE(sig >= 0);
|
||||
sig = -sig;
|
||||
|
||||
if (act) {
|
||||
unsigned long mask;
|
||||
@ -446,11 +443,6 @@ sys_rt_sigaction(int sig,
|
||||
if (sigsetsize != sizeof(sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
/* All tasks which use RT signals (effectively) use
|
||||
* new style signals.
|
||||
*/
|
||||
current->thread.new_signal = 1;
|
||||
|
||||
if (act) {
|
||||
new_ka.ka_restorer = restorer;
|
||||
if (copy_from_user(&new_ka.sa, act, sizeof(*act)))
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: process.c,v 1.131 2002/02/09 19:49:30 davem Exp $
|
||||
* arch/sparc64/kernel/process.c
|
||||
/* arch/sparc64/kernel/process.c
|
||||
*
|
||||
* Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
|
||||
* Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
|
||||
@ -368,9 +367,6 @@ void flush_thread(void)
|
||||
|
||||
if (get_thread_current_ds() != ASI_AIUS)
|
||||
set_fs(USER_DS);
|
||||
|
||||
/* Init new signal delivery disposition. */
|
||||
clear_thread_flag(TIF_NEWSIGNALS);
|
||||
}
|
||||
|
||||
/* It's a bit more tricky when 64-bit tasks are involved... */
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: signal32.c,v 1.74 2002/02/09 19:49:30 davem Exp $
|
||||
* arch/sparc64/kernel/signal32.c
|
||||
/* arch/sparc64/kernel/signal32.c
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
@ -31,30 +30,6 @@
|
||||
|
||||
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
|
||||
|
||||
/* Signal frames: the original one (compatible with SunOS):
|
||||
*
|
||||
* Set up a signal frame... Make the stack look the way SunOS
|
||||
* expects it to look which is basically:
|
||||
*
|
||||
* ---------------------------------- <-- %sp at signal time
|
||||
* Struct sigcontext
|
||||
* Signal address
|
||||
* Ptr to sigcontext area above
|
||||
* Signal code
|
||||
* The signal number itself
|
||||
* One register window
|
||||
* ---------------------------------- <-- New %sp
|
||||
*/
|
||||
struct signal_sframe32 {
|
||||
struct reg_window32 sig_window;
|
||||
int sig_num;
|
||||
int sig_code;
|
||||
/* struct sigcontext32 * */ u32 sig_scptr;
|
||||
int sig_address;
|
||||
struct sigcontext32 sig_context;
|
||||
unsigned int extramask[_COMPAT_NSIG_WORDS - 1];
|
||||
};
|
||||
|
||||
/* This magic should be in g_upper[0] for all upper parts
|
||||
* to be valid.
|
||||
*/
|
||||
@ -65,12 +40,7 @@ typedef struct {
|
||||
unsigned int asi;
|
||||
} siginfo_extra_v8plus_t;
|
||||
|
||||
/*
|
||||
* And the new one, intended to be used for Linux applications only
|
||||
* (we have enough in there to work with clone).
|
||||
* All the interesting bits are in the info field.
|
||||
*/
|
||||
struct new_signal_frame32 {
|
||||
struct signal_frame32 {
|
||||
struct sparc_stackf32 ss;
|
||||
__siginfo32_t info;
|
||||
/* __siginfo_fpu32_t * */ u32 fpu_save;
|
||||
@ -149,8 +119,7 @@ struct rt_signal_frame32 {
|
||||
};
|
||||
|
||||
/* Align macros */
|
||||
#define SF_ALIGNEDSZ (((sizeof(struct signal_sframe32) + 7) & (~7)))
|
||||
#define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame32) + 7) & (~7)))
|
||||
#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 7) & (~7)))
|
||||
#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 7) & (~7)))
|
||||
|
||||
int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
|
||||
@ -241,17 +210,22 @@ static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu
|
||||
return err;
|
||||
}
|
||||
|
||||
void do_new_sigreturn32(struct pt_regs *regs)
|
||||
void do_sigreturn32(struct pt_regs *regs)
|
||||
{
|
||||
struct new_signal_frame32 __user *sf;
|
||||
struct signal_frame32 __user *sf;
|
||||
unsigned int psr;
|
||||
unsigned pc, npc, fpu_save;
|
||||
sigset_t set;
|
||||
unsigned seta[_COMPAT_NSIG_WORDS];
|
||||
int err, i;
|
||||
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
synchronize_user_stack();
|
||||
|
||||
regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL;
|
||||
sf = (struct new_signal_frame32 __user *) regs->u_regs[UREG_FP];
|
||||
sf = (struct signal_frame32 __user *) regs->u_regs[UREG_FP];
|
||||
|
||||
/* 1. Make sure we are not getting garbage from the user */
|
||||
if (!access_ok(VERIFY_READ, sf, sizeof(*sf)) ||
|
||||
@ -319,76 +293,6 @@ segv:
|
||||
force_sig(SIGSEGV, current);
|
||||
}
|
||||
|
||||
asmlinkage void do_sigreturn32(struct pt_regs *regs)
|
||||
{
|
||||
struct sigcontext32 __user *scptr;
|
||||
unsigned int pc, npc, psr;
|
||||
sigset_t set;
|
||||
unsigned int seta[_COMPAT_NSIG_WORDS];
|
||||
int err;
|
||||
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
synchronize_user_stack();
|
||||
if (test_thread_flag(TIF_NEWSIGNALS)) {
|
||||
do_new_sigreturn32(regs);
|
||||
return;
|
||||
}
|
||||
|
||||
scptr = (struct sigcontext32 __user *)
|
||||
(regs->u_regs[UREG_I0] & 0x00000000ffffffffUL);
|
||||
/* Check sanity of the user arg. */
|
||||
if (!access_ok(VERIFY_READ, scptr, sizeof(struct sigcontext32)) ||
|
||||
(((unsigned long) scptr) & 3))
|
||||
goto segv;
|
||||
|
||||
err = __get_user(pc, &scptr->sigc_pc);
|
||||
err |= __get_user(npc, &scptr->sigc_npc);
|
||||
|
||||
if ((pc | npc) & 3)
|
||||
goto segv; /* Nice try. */
|
||||
|
||||
err |= __get_user(seta[0], &scptr->sigc_mask);
|
||||
/* Note that scptr + 1 points to extramask */
|
||||
err |= copy_from_user(seta+1, scptr + 1,
|
||||
(_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
|
||||
if (err)
|
||||
goto segv;
|
||||
switch (_NSIG_WORDS) {
|
||||
case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32);
|
||||
case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32);
|
||||
case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32);
|
||||
case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
|
||||
}
|
||||
sigdelsetmask(&set, ~_BLOCKABLE);
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
current->blocked = set;
|
||||
recalc_sigpending();
|
||||
spin_unlock_irq(¤t->sighand->siglock);
|
||||
|
||||
if (test_thread_flag(TIF_32BIT)) {
|
||||
pc &= 0xffffffff;
|
||||
npc &= 0xffffffff;
|
||||
}
|
||||
regs->tpc = pc;
|
||||
regs->tnpc = npc;
|
||||
err = __get_user(regs->u_regs[UREG_FP], &scptr->sigc_sp);
|
||||
err |= __get_user(regs->u_regs[UREG_I0], &scptr->sigc_o0);
|
||||
err |= __get_user(regs->u_regs[UREG_G1], &scptr->sigc_g1);
|
||||
|
||||
/* User can only change condition codes in %tstate. */
|
||||
err |= __get_user(psr, &scptr->sigc_psr);
|
||||
if (err)
|
||||
goto segv;
|
||||
regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
|
||||
regs->tstate |= psr_to_tstate_icc(psr);
|
||||
return;
|
||||
|
||||
segv:
|
||||
force_sig(SIGSEGV, current);
|
||||
}
|
||||
|
||||
asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
|
||||
{
|
||||
struct rt_signal_frame32 __user *sf;
|
||||
@ -504,145 +408,6 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
|
||||
return (void __user *)(sp - framesize);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_frame32(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *oldset, siginfo_t *info)
|
||||
{
|
||||
struct signal_sframe32 __user *sframep;
|
||||
struct sigcontext32 __user *sc;
|
||||
unsigned int seta[_COMPAT_NSIG_WORDS];
|
||||
int err = 0;
|
||||
void __user *sig_address;
|
||||
int sig_code;
|
||||
unsigned long pc = regs->tpc;
|
||||
unsigned long npc = regs->tnpc;
|
||||
unsigned int psr;
|
||||
|
||||
if (test_thread_flag(TIF_32BIT)) {
|
||||
pc &= 0xffffffff;
|
||||
npc &= 0xffffffff;
|
||||
}
|
||||
|
||||
synchronize_user_stack();
|
||||
save_and_clear_fpu();
|
||||
|
||||
sframep = (struct signal_sframe32 __user *)
|
||||
get_sigframe(sa, regs, SF_ALIGNEDSZ);
|
||||
if (invalid_frame_pointer(sframep, sizeof(*sframep))){
|
||||
/* Don't change signal code and address, so that
|
||||
* post mortem debuggers can have a look.
|
||||
*/
|
||||
do_exit(SIGILL);
|
||||
}
|
||||
|
||||
sc = &sframep->sig_context;
|
||||
|
||||
/* We've already made sure frame pointer isn't in kernel space... */
|
||||
err = __put_user((sas_ss_flags(regs->u_regs[UREG_FP]) == SS_ONSTACK),
|
||||
&sc->sigc_onstack);
|
||||
|
||||
switch (_NSIG_WORDS) {
|
||||
case 4: seta[7] = (oldset->sig[3] >> 32);
|
||||
seta[6] = oldset->sig[3];
|
||||
case 3: seta[5] = (oldset->sig[2] >> 32);
|
||||
seta[4] = oldset->sig[2];
|
||||
case 2: seta[3] = (oldset->sig[1] >> 32);
|
||||
seta[2] = oldset->sig[1];
|
||||
case 1: seta[1] = (oldset->sig[0] >> 32);
|
||||
seta[0] = oldset->sig[0];
|
||||
}
|
||||
err |= __put_user(seta[0], &sc->sigc_mask);
|
||||
err |= __copy_to_user(sframep->extramask, seta + 1,
|
||||
(_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
|
||||
err |= __put_user(regs->u_regs[UREG_FP], &sc->sigc_sp);
|
||||
err |= __put_user(pc, &sc->sigc_pc);
|
||||
err |= __put_user(npc, &sc->sigc_npc);
|
||||
psr = tstate_to_psr(regs->tstate);
|
||||
if (current_thread_info()->fpsaved[0] & FPRS_FEF)
|
||||
psr |= PSR_EF;
|
||||
err |= __put_user(psr, &sc->sigc_psr);
|
||||
err |= __put_user(regs->u_regs[UREG_G1], &sc->sigc_g1);
|
||||
err |= __put_user(regs->u_regs[UREG_I0], &sc->sigc_o0);
|
||||
err |= __put_user(get_thread_wsaved(), &sc->sigc_oswins);
|
||||
|
||||
err |= copy_in_user((u32 __user *)sframep,
|
||||
(u32 __user *)(regs->u_regs[UREG_FP]),
|
||||
sizeof(struct reg_window32));
|
||||
|
||||
set_thread_wsaved(0); /* So process is allowed to execute. */
|
||||
err |= __put_user(signr, &sframep->sig_num);
|
||||
sig_address = NULL;
|
||||
sig_code = 0;
|
||||
if (SI_FROMKERNEL (info) && (info->si_code & __SI_MASK) == __SI_FAULT) {
|
||||
sig_address = info->si_addr;
|
||||
switch (signr) {
|
||||
case SIGSEGV:
|
||||
switch (info->si_code) {
|
||||
case SEGV_MAPERR: sig_code = SUBSIG_NOMAPPING; break;
|
||||
default: sig_code = SUBSIG_PROTECTION; break;
|
||||
}
|
||||
break;
|
||||
case SIGILL:
|
||||
switch (info->si_code) {
|
||||
case ILL_ILLOPC: sig_code = SUBSIG_ILLINST; break;
|
||||
case ILL_PRVOPC: sig_code = SUBSIG_PRIVINST; break;
|
||||
case ILL_ILLTRP: sig_code = SUBSIG_BADTRAP(info->si_trapno); break;
|
||||
default: sig_code = SUBSIG_STACK; break;
|
||||
}
|
||||
break;
|
||||
case SIGFPE:
|
||||
switch (info->si_code) {
|
||||
case FPE_INTDIV: sig_code = SUBSIG_IDIVZERO; break;
|
||||
case FPE_INTOVF: sig_code = SUBSIG_FPINTOVFL; break;
|
||||
case FPE_FLTDIV: sig_code = SUBSIG_FPDIVZERO; break;
|
||||
case FPE_FLTOVF: sig_code = SUBSIG_FPOVFLOW; break;
|
||||
case FPE_FLTUND: sig_code = SUBSIG_FPUNFLOW; break;
|
||||
case FPE_FLTRES: sig_code = SUBSIG_FPINEXACT; break;
|
||||
case FPE_FLTINV: sig_code = SUBSIG_FPOPERROR; break;
|
||||
default: sig_code = SUBSIG_FPERROR; break;
|
||||
}
|
||||
break;
|
||||
case SIGBUS:
|
||||
switch (info->si_code) {
|
||||
case BUS_ADRALN: sig_code = SUBSIG_ALIGNMENT; break;
|
||||
case BUS_ADRERR: sig_code = SUBSIG_MISCERROR; break;
|
||||
default: sig_code = SUBSIG_BUSTIMEOUT; break;
|
||||
}
|
||||
break;
|
||||
case SIGEMT:
|
||||
switch (info->si_code) {
|
||||
case EMT_TAGOVF: sig_code = SUBSIG_TAG; break;
|
||||
}
|
||||
break;
|
||||
case SIGSYS:
|
||||
if (info->si_code == (__SI_FAULT|0x100)) {
|
||||
/* See sys_sunos32.c */
|
||||
sig_code = info->si_trapno;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sig_address = NULL;
|
||||
}
|
||||
}
|
||||
err |= __put_user(ptr_to_compat(sig_address), &sframep->sig_address);
|
||||
err |= __put_user(sig_code, &sframep->sig_code);
|
||||
err |= __put_user(ptr_to_compat(sc), &sframep->sig_scptr);
|
||||
if (err)
|
||||
goto sigsegv;
|
||||
|
||||
regs->u_regs[UREG_FP] = (unsigned long) sframep;
|
||||
regs->tpc = (unsigned long) sa->sa_handler;
|
||||
regs->tnpc = (regs->tpc + 4);
|
||||
if (test_thread_flag(TIF_32BIT)) {
|
||||
regs->tpc &= 0xffffffff;
|
||||
regs->tnpc &= 0xffffffff;
|
||||
}
|
||||
return;
|
||||
|
||||
sigsegv:
|
||||
force_sigsegv(signr, current);
|
||||
}
|
||||
|
||||
|
||||
static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
|
||||
{
|
||||
unsigned long *fpregs = current_thread_info()->fpregs;
|
||||
@ -663,10 +428,10 @@ static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
|
||||
return err;
|
||||
}
|
||||
|
||||
static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset)
|
||||
static void setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
int signo, sigset_t *oldset)
|
||||
{
|
||||
struct new_signal_frame32 __user *sf;
|
||||
struct signal_frame32 __user *sf;
|
||||
int sigframe_size;
|
||||
u32 psr;
|
||||
int i, err;
|
||||
@ -676,11 +441,11 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
|
||||
synchronize_user_stack();
|
||||
save_and_clear_fpu();
|
||||
|
||||
sigframe_size = NF_ALIGNEDSZ;
|
||||
sigframe_size = SF_ALIGNEDSZ;
|
||||
if (!(current_thread_info()->fpsaved[0] & FPRS_FEF))
|
||||
sigframe_size -= sizeof(__siginfo_fpu_t);
|
||||
|
||||
sf = (struct new_signal_frame32 __user *)
|
||||
sf = (struct signal_frame32 __user *)
|
||||
get_sigframe(&ka->sa, regs, sigframe_size);
|
||||
|
||||
if (invalid_frame_pointer(sf, sigframe_size))
|
||||
@ -944,10 +709,9 @@ static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka,
|
||||
{
|
||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
||||
setup_rt_frame32(ka, regs, signr, oldset, info);
|
||||
else if (test_thread_flag(TIF_NEWSIGNALS))
|
||||
new_setup_frame32(ka, regs, signr, oldset);
|
||||
else
|
||||
setup_frame32(&ka->sa, regs, signr, oldset, info);
|
||||
setup_frame32(ka, regs, signr, oldset);
|
||||
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
||||
if (!(ka->sa.sa_flags & SA_NOMASK))
|
||||
|
@ -554,10 +554,8 @@ asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act
|
||||
struct k_sigaction new_ka, old_ka;
|
||||
int ret;
|
||||
|
||||
if (sig < 0) {
|
||||
set_thread_flag(TIF_NEWSIGNALS);
|
||||
sig = -sig;
|
||||
}
|
||||
WARN_ON_ONCE(sig >= 0);
|
||||
sig = -sig;
|
||||
|
||||
if (act) {
|
||||
compat_old_sigset_t mask;
|
||||
@ -601,11 +599,6 @@ asmlinkage long compat_sys_rt_sigaction(int sig,
|
||||
if (sigsetsize != sizeof(compat_sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
/* All tasks which use RT signals (effectively) use
|
||||
* new style signals.
|
||||
*/
|
||||
set_thread_flag(TIF_NEWSIGNALS);
|
||||
|
||||
if (act) {
|
||||
u32 u_handler, u_restorer;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: processor.h,v 1.83 2001/10/08 09:32:13 davem Exp $
|
||||
* include/asm-sparc/processor.h
|
||||
/* include/asm-sparc/processor.h
|
||||
*
|
||||
* Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
@ -65,7 +64,6 @@ struct thread_struct {
|
||||
struct fpq fpqueue[16];
|
||||
unsigned long flags;
|
||||
mm_segment_t current_ds;
|
||||
int new_signal;
|
||||
};
|
||||
|
||||
#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* $Id: thread_info.h,v 1.1 2002/02/10 00:00:58 davem Exp $
|
||||
* thread_info.h: sparc64 low-level thread information
|
||||
/* thread_info.h: sparc64 low-level thread information
|
||||
*
|
||||
* Copyright (C) 2002 David S. Miller (davem@redhat.com)
|
||||
*/
|
||||
@ -223,7 +222,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
|
||||
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
|
||||
#define TIF_PERFCTR 4 /* performance counters active */
|
||||
#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
|
||||
#define TIF_NEWSIGNALS 6 /* wants new-style signals */
|
||||
/* flag bit 6 is available */
|
||||
#define TIF_32BIT 7 /* 32-bit binary */
|
||||
/* flag bit 8 is available */
|
||||
#define TIF_SECCOMP 9 /* secure computing */
|
||||
@ -242,7 +241,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
|
||||
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
|
||||
#define _TIF_PERFCTR (1<<TIF_PERFCTR)
|
||||
#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
|
||||
#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS)
|
||||
#define _TIF_32BIT (1<<TIF_32BIT)
|
||||
#define _TIF_SECCOMP (1<<TIF_SECCOMP)
|
||||
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
|
||||
|
Loading…
Reference in New Issue
Block a user