signal: Ensure every siginfo we send has all bits initialized
Call clear_siginfo to ensure every stack allocated siginfo is properly initialized before being passed to the signal sending functions. Note: It is not safe to depend on C initializers to initialize struct siginfo on the stack because C is allowed to skip holes when initializing a structure. The initialization of struct siginfo in tracehook_report_syscall_exit was moved from the helper user_single_step_siginfo into tracehook_report_syscall_exit itself, to make it clear that the local variable siginfo gets fully initialized. In a few cases the scope of struct siginfo has been reduced to make it clear that siginfo siginfo is not used on other paths in the function in which it is declared. Instances of using memset to initialize siginfo have been replaced with calls clear_siginfo for clarity. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@@ -881,6 +881,7 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
|
||||
if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV;
|
||||
if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV;
|
||||
|
||||
clear_siginfo(&info);
|
||||
info.si_signo = SIGFPE;
|
||||
info.si_errno = 0;
|
||||
info.si_code = si_code;
|
||||
|
@@ -221,6 +221,7 @@ do_sigreturn(struct sigcontext __user *sc)
|
||||
if (ptrace_cancel_bpt (current)) {
|
||||
siginfo_t info;
|
||||
|
||||
clear_siginfo(&info);
|
||||
info.si_signo = SIGTRAP;
|
||||
info.si_errno = 0;
|
||||
info.si_code = TRAP_BRKPT;
|
||||
@@ -255,6 +256,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame)
|
||||
if (ptrace_cancel_bpt (current)) {
|
||||
siginfo_t info;
|
||||
|
||||
clear_siginfo(&info);
|
||||
info.si_signo = SIGTRAP;
|
||||
info.si_errno = 0;
|
||||
info.si_code = TRAP_BRKPT;
|
||||
|
@@ -228,6 +228,7 @@ do_entArith(unsigned long summary, unsigned long write_mask,
|
||||
}
|
||||
die_if_kernel("Arithmetic fault", regs, 0, NULL);
|
||||
|
||||
clear_siginfo(&info);
|
||||
info.si_signo = SIGFPE;
|
||||
info.si_errno = 0;
|
||||
info.si_code = si_code;
|
||||
@@ -241,6 +242,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
|
||||
siginfo_t info;
|
||||
int signo, code;
|
||||
|
||||
clear_siginfo(&info);
|
||||
if ((regs->ps & ~IPL_MAX) == 0) {
|
||||
if (type == 1) {
|
||||
const unsigned int *data
|
||||
@@ -430,6 +432,7 @@ do_entDbg(struct pt_regs *regs)
|
||||
|
||||
die_if_kernel("Instruction fault", regs, 0, NULL);
|
||||
|
||||
clear_siginfo(&info);
|
||||
info.si_signo = SIGILL;
|
||||
info.si_errno = 0;
|
||||
info.si_code = ILL_ILLOPC;
|
||||
@@ -761,6 +764,8 @@ do_entUnaUser(void __user * va, unsigned long opcode,
|
||||
siginfo_t info;
|
||||
long error;
|
||||
|
||||
clear_siginfo(&info);
|
||||
|
||||
/* Check the UAC bits to decide what the user wants us to do
|
||||
with the unaliged access. */
|
||||
|
||||
|
Reference in New Issue
Block a user