linux/arch/s390/include/uapi/asm/sigcontext.h
Martin Schwidefsky 4725c86055 s390: fix save and restore of the floating-point-control register
The FPC_VALID_MASK has been used to check the validity of the value
to be loaded into the floating-point-control register. With the
introduction of the floating-point extension facility and the
decimal-floating-point additional bits have been defined which need
to be checked in a non straight forward way. So far these bits have
been ignored which can cause an incorrect results for decimal-
floating-point operations, e.g. an incorrect rounding mode to be
set after signal return.

The static check with the FPC_VALID_MASK is replaced with a trial
load of the floating-point-control value, see test_fp_ctl.

In addition an information leak with the padding word between the
floating-point-control word and the floating-point registers in
the s390_fp_regs is fixed.

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-10-24 17:17:11 +02:00

71 lines
1.4 KiB
C

/*
* S390 version
* Copyright IBM Corp. 1999, 2000
*/
#ifndef _ASM_S390_SIGCONTEXT_H
#define _ASM_S390_SIGCONTEXT_H
#include <linux/compiler.h>
#define __NUM_GPRS 16
#define __NUM_FPRS 16
#define __NUM_ACRS 16
#ifndef __s390x__
/* Has to be at least _NSIG_WORDS from asm/signal.h */
#define _SIGCONTEXT_NSIG 64
#define _SIGCONTEXT_NSIG_BPW 32
/* Size of stack frame allocated when calling signal handler. */
#define __SIGNAL_FRAMESIZE 96
#else /* __s390x__ */
/* Has to be at least _NSIG_WORDS from asm/signal.h */
#define _SIGCONTEXT_NSIG 64
#define _SIGCONTEXT_NSIG_BPW 64
/* Size of stack frame allocated when calling signal handler. */
#define __SIGNAL_FRAMESIZE 160
#endif /* __s390x__ */
#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
#define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
typedef struct
{
unsigned long mask;
unsigned long addr;
} __attribute__ ((aligned(8))) _psw_t;
typedef struct
{
_psw_t psw;
unsigned long gprs[__NUM_GPRS];
unsigned int acrs[__NUM_ACRS];
} _s390_regs_common;
typedef struct
{
unsigned int fpc;
unsigned int pad;
double fprs[__NUM_FPRS];
} _s390_fp_regs;
typedef struct
{
_s390_regs_common regs;
_s390_fp_regs fpregs;
} _sigregs;
struct sigcontext
{
unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS];
_sigregs __user *sregs;
};
#endif