aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2018-04-17 16:26:37 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-04-25 11:40:51 -0400
commit3eb0f5193b497083391aa05d35210d5645211eef (patch)
tree65f009d4cdd5e407741a4431c0aacd40452779bd /arch/powerpc/kernel
parentf6ed1ecad56fec7ab5c6bf741064b95801e9688f (diff)
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>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/process.c1
-rw-r--r--arch/powerpc/kernel/traps.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1237f13fed51..26ea9793d290 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -632,6 +632,7 @@ void do_break (struct pt_regs *regs, unsigned long address,
632 hw_breakpoint_disable(); 632 hw_breakpoint_disable();
633 633
634 /* Deliver the signal to userspace */ 634 /* Deliver the signal to userspace */
635 clear_siginfo(&info);
635 info.si_signo = SIGTRAP; 636 info.si_signo = SIGTRAP;
636 info.si_errno = 0; 637 info.si_errno = 0;
637 info.si_code = TRAP_HWBKPT; 638 info.si_code = TRAP_HWBKPT;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0904492e7032..087855caf6a9 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -296,7 +296,6 @@ NOKPROBE_SYMBOL(die);
296void user_single_step_siginfo(struct task_struct *tsk, 296void user_single_step_siginfo(struct task_struct *tsk,
297 struct pt_regs *regs, siginfo_t *info) 297 struct pt_regs *regs, siginfo_t *info)
298{ 298{
299 memset(info, 0, sizeof(*info));
300 info->si_signo = SIGTRAP; 299 info->si_signo = SIGTRAP;
301 info->si_code = TRAP_TRACE; 300 info->si_code = TRAP_TRACE;
302 info->si_addr = (void __user *)regs->nip; 301 info->si_addr = (void __user *)regs->nip;
@@ -334,7 +333,7 @@ void _exception_pkey(int signr, struct pt_regs *regs, int code,
334 */ 333 */
335 thread_pkey_regs_save(&current->thread); 334 thread_pkey_regs_save(&current->thread);
336 335
337 memset(&info, 0, sizeof(info)); 336 clear_siginfo(&info);
338 info.si_signo = signr; 337 info.si_signo = signr;
339 info.si_code = code; 338 info.si_code = code;
340 info.si_addr = (void __user *) addr; 339 info.si_addr = (void __user *) addr;