Make MINSIGSTKSZ machine dependent, and have the sigaltstack
syscall compare against a variable sv_minsigstksz in struct sysentvec as to properly take the size of the machine- and ABI dependent struct sigframe into account. The SVR4 and iBCS2 modules continue to have a minsigstksz of 8192 to preserve behavior. The real values (if different) are not known at this time. Other ABI modules use the real values. The native MINSIGSTKSZ is now defined as follows: Arch MINSIGSTKSZ ---- ----------- alpha 4096 i386 2048 ia64 12288 Reviewed by: mjacob Suggested by: bde
This commit is contained in:
parent
2da829a0c8
commit
806d7daafe
|
@ -35,6 +35,12 @@ typedef long sig_atomic_t;
|
|||
|
||||
#ifndef _ANSI_SOURCE
|
||||
|
||||
/*
|
||||
* Minimum signal stack size. The current signal frame
|
||||
* for Alpha is 808 bytes large.
|
||||
*/
|
||||
#define MINSIGSTKSZ (1024 * 4)
|
||||
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
|
|
|
@ -159,6 +159,8 @@ struct linux_new_utsname {
|
|||
#define LINUX_SIGISMEMBER(set, sig) SIGISMEMBER(set, sig)
|
||||
#define LINUX_SIGADDSET(set, sig) SIGADDSET(set, sig)
|
||||
|
||||
#define LINUX_MINSIGSTKSZ 4096
|
||||
|
||||
typedef void (*linux_handler_t)(int);
|
||||
typedef u_long linux_osigset_t;
|
||||
|
||||
|
|
|
@ -186,7 +186,8 @@ struct sysentvec elf_linux_sysvec = {
|
|||
0,
|
||||
"Linux ELF",
|
||||
elf_coredump,
|
||||
exec_linux_imgact_try
|
||||
exec_linux_imgact_try,
|
||||
LINUX_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo linux_brand = {
|
||||
|
|
|
@ -31,6 +31,7 @@ extern struct sysent osf1_sysent[];
|
|||
extern int bsd_to_osf1_sig[];
|
||||
extern int bsd_to_osf1_errno[];
|
||||
|
||||
#define OSF1_MINSIGSTKSZ 4096
|
||||
|
||||
/* osf/1 ioctls */
|
||||
#define OSF1_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
|
||||
|
|
|
@ -74,8 +74,9 @@ struct sysentvec osf1_sysvec = {
|
|||
&osf1_szsigcode, /* use generic trampoline size */
|
||||
0, /* prepsyscall */
|
||||
"OSF/1 ECOFF",
|
||||
NULL /* we don't have an ECOFF coredump function */
|
||||
|
||||
NULL, /* we don't have an ECOFF coredump function */
|
||||
NULL,
|
||||
OSF1_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,12 @@ typedef int sig_atomic_t;
|
|||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
|
||||
/*
|
||||
* Minimum signal stack size. The current signal frame
|
||||
* for i386 is 408 bytes large.
|
||||
*/
|
||||
#define MINSIGSTKSZ (512 * 4)
|
||||
|
||||
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
|
||||
|
||||
/*
|
||||
|
|
|
@ -132,6 +132,8 @@ struct svr4_sigaltstack {
|
|||
#define SVR4_SS_DISABLE 0x00000002
|
||||
#define SVR4_SS_ALLBITS 0x00000003
|
||||
|
||||
#define SVR4_MINSIGSTKSZ 8192
|
||||
|
||||
void bsd_to_svr4_sigaltstack __P((const struct sigaltstack *, struct svr4_sigaltstack *));
|
||||
void bsd_to_svr4_sigset __P((const sigset_t *, svr4_sigset_t *));
|
||||
void svr4_to_bsd_sigaltstack __P((const struct svr4_sigaltstack *, struct sigaltstack *));
|
||||
|
|
|
@ -177,7 +177,9 @@ struct sysentvec svr4_sysvec = {
|
|||
&svr4_szsigcode,
|
||||
NULL,
|
||||
"SVR4",
|
||||
elf_coredump
|
||||
elf_coredump,
|
||||
NULL,
|
||||
SVR4_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
Elf32_Brandinfo svr4_brand = {
|
||||
|
|
|
@ -103,6 +103,8 @@ struct ibcs2_sigaction {
|
|||
/* sa_flags */
|
||||
#define IBCS2_SA_NOCLDSTOP 1
|
||||
|
||||
#define IBCS2_MINSIGSTKSZ 8192
|
||||
|
||||
extern int bsd_to_ibcs2_sig[];
|
||||
|
||||
#endif /* _IBCS2_SIGNAL_H */
|
||||
|
|
|
@ -62,7 +62,9 @@ struct sysentvec ibcs2_svr3_sysvec = {
|
|||
&szsigcode, /* use generic trampoline size */
|
||||
0, /* prepsyscall */
|
||||
"IBCS2 COFF",
|
||||
NULL /* we don't have a COFF coredump function */
|
||||
NULL, /* we don't have a COFF coredump function */
|
||||
NULL,
|
||||
IBCS2_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,12 @@ typedef int sig_atomic_t;
|
|||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
|
||||
/*
|
||||
* Minimum signal stack size. The current signal frame
|
||||
* for i386 is 408 bytes large.
|
||||
*/
|
||||
#define MINSIGSTKSZ (512 * 4)
|
||||
|
||||
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
|
||||
|
||||
/*
|
||||
|
|
|
@ -668,8 +668,7 @@ linux_sigaltstack(p, uap)
|
|||
|
||||
ss = stackgap_alloc(&sg, sizeof(stack_t));
|
||||
ss->ss_sp = lss.ss_sp;
|
||||
ss->ss_size = (lss.ss_size >= LINUX_MINSIGSTKSZ &&
|
||||
lss.ss_size < MINSIGSTKSZ) ? MINSIGSTKSZ : lss.ss_size;
|
||||
ss->ss_size = lss.ss_size;
|
||||
ss->ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags);
|
||||
}
|
||||
oss = (uap->uoss != NULL)
|
||||
|
@ -686,8 +685,6 @@ linux_sigaltstack(p, uap)
|
|||
lss.ss_flags = bsd_to_linux_sigaltstack(oss->ss_flags);
|
||||
error = copyout(&lss, uap->uoss, sizeof(linux_stack_t));
|
||||
}
|
||||
if (!error && (ss != NULL) && (lss.ss_size < ss->ss_size))
|
||||
p->p_sigstk.ss_size = lss.ss_size;
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
|
|
@ -633,15 +633,13 @@ linux_rt_sigreturn(p, args)
|
|||
regs->tf_esp = context->sc_esp_at_signal;
|
||||
regs->tf_ss = context->sc_ss;
|
||||
|
||||
|
||||
/*
|
||||
* call sigaltstack & ignore results..
|
||||
*/
|
||||
ss = stackgap_alloc(&sg, sizeof(stack_t));
|
||||
lss = &uc.uc_stack;
|
||||
ss->ss_sp = lss->ss_sp;
|
||||
ss->ss_size = (lss->ss_size >= LINUX_MINSIGSTKSZ &&
|
||||
lss->ss_size < MINSIGSTKSZ) ? MINSIGSTKSZ : lss->ss_size;
|
||||
ss->ss_size = lss->ss_size;
|
||||
ss->ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -726,7 +724,8 @@ struct sysentvec linux_sysvec = {
|
|||
linux_prepsyscall,
|
||||
"Linux a.out",
|
||||
aout_coredump,
|
||||
exec_linux_imgact_try
|
||||
exec_linux_imgact_try,
|
||||
LINUX_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
struct sysentvec elf_linux_sysvec = {
|
||||
|
@ -745,7 +744,8 @@ struct sysentvec elf_linux_sysvec = {
|
|||
linux_prepsyscall,
|
||||
"Linux ELF",
|
||||
elf_coredump,
|
||||
exec_linux_imgact_try
|
||||
exec_linux_imgact_try,
|
||||
LINUX_MINSIGSTKSZ
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_brand = {
|
||||
|
|
|
@ -35,6 +35,12 @@ typedef long sig_atomic_t;
|
|||
|
||||
#ifndef _ANSI_SOURCE
|
||||
|
||||
/*
|
||||
* Minimum signal stack size. The current signal frame
|
||||
* for IA-64 is 2656 bytes large.
|
||||
*/
|
||||
#define MINSIGSTKSZ (3072 * 4)
|
||||
|
||||
#ifndef _IA64_FPREG_DEFINED
|
||||
|
||||
struct ia64_fpreg {
|
||||
|
|
|
@ -69,7 +69,9 @@ struct sysentvec aout_sysvec = {
|
|||
&szsigcode,
|
||||
0,
|
||||
"FreeBSD a.out",
|
||||
aout_coredump
|
||||
aout_coredump,
|
||||
NULL,
|
||||
MINSIGSTKSZ
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
@ -99,7 +99,9 @@ struct sysentvec elf_freebsd_sysvec = {
|
|||
&szsigcode,
|
||||
0,
|
||||
"FreeBSD ELF",
|
||||
elf_coredump
|
||||
elf_coredump,
|
||||
NULL,
|
||||
MINSIGSTKSZ
|
||||
};
|
||||
|
||||
static Elf_Brandinfo freebsd_brand_info = {
|
||||
|
|
|
@ -830,7 +830,7 @@ sigaltstack(p, uap)
|
|||
p->p_sigstk.ss_flags = ss.ss_flags;
|
||||
return (0);
|
||||
}
|
||||
if (ss.ss_size < MINSIGSTKSZ)
|
||||
if (ss.ss_size < p->p_sysent->sv_minsigstksz)
|
||||
return (ENOMEM);
|
||||
p->p_flag |= P_ALTSTACK;
|
||||
p->p_sigstk = ss;
|
||||
|
|
|
@ -238,7 +238,6 @@ typedef struct sigaltstack {
|
|||
|
||||
#define SS_ONSTACK 0x0001 /* take signal on alternate stack */
|
||||
#define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
|
||||
#define MINSIGSTKSZ 8192 /* minimum allowable stack */
|
||||
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
|
||||
|
||||
/* Have enough typedefs for this now. XXX */
|
||||
|
|
|
@ -238,7 +238,6 @@ typedef struct sigaltstack {
|
|||
|
||||
#define SS_ONSTACK 0x0001 /* take signal on alternate stack */
|
||||
#define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
|
||||
#define MINSIGSTKSZ 8192 /* minimum allowable stack */
|
||||
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
|
||||
|
||||
/* Have enough typedefs for this now. XXX */
|
||||
|
|
|
@ -80,6 +80,7 @@ struct sysentvec {
|
|||
off_t));
|
||||
/* function to dump core, or NULL */
|
||||
int (*sv_imgact_try) __P((struct image_params *));
|
||||
int sv_minsigstksz; /* minimum signal stack size */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
|
Loading…
Reference in New Issue