Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo

has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.
This commit is contained in:
maxv 2018-11-27 14:09:53 +00:00
parent f3f43bfe46
commit d8ce26fe5b
17 changed files with 54 additions and 47 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.2 2018/10/12 01:28:57 ryo Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.3 2018/11/27 14:09:53 maxv Exp $ */
/*
* Copyright (c) 2018 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.2 2018/10/12 01:28:57 ryo Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.3 2018/11/27 14:09:53 maxv Exp $");
#include "opt_compat_netbsd.h"
@ -223,6 +223,8 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp = (struct netbsd32_sigframe_siginfo *)sp;
fp = (struct netbsd32_sigframe_siginfo *)STACK_ALIGN(fp - 1, 8);
memset(&frame, 0, sizeof(frame));
/* XXX: netbsd32_ksi_to_si32 */
netbsd32_si_to_si32(&frame.sf_si, (const siginfo_t *)&ksi->ksi_info);
@ -231,7 +233,6 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
frame.sf_uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink;
frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK) ?
_UC_SETSTACK : _UC_CLRSTACK;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, signo);
mutex_exit(p->p_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.351 2018/09/03 16:29:22 riastradh Exp $ */
/* $NetBSD: machdep.c,v 1.352 2018/11/27 14:09:53 maxv Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.351 2018/09/03 16:29:22 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.352 2018/11/27 14:09:53 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1467,12 +1467,11 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
#endif
/* Build stack frame for signal trampoline. */
memset(&frame, 0, sizeof(frame));
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_flags = _UC_SIGMASK;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = l->l_ctxlink;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &frame.sf_uc.uc_mcontext, &frame.sf_uc.uc_flags);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.116 2018/07/26 09:29:08 maxv Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.117 2018/11/27 14:09:53 maxv Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.116 2018/07/26 09:29:08 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.117 2018/11/27 14:09:53 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -225,6 +225,8 @@ netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
fp = (struct netbsd32_sigframe_sigcontext *)tf->tf_rsp;
fp--;
memset(&frame, 0, sizeof(frame));
/* Build stack frame for signal trampoline. */
switch (ps->sa_sigdesc[sig].sd_vers) {
case 0:
@ -324,6 +326,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
break;
}
memset(&frame, 0, sizeof(frame));
frame.sf_ra = (uint32_t)(uintptr_t)ps->sa_sigdesc[sig].sd_tramp;
frame.sf_signum = sig;
frame.sf_sip = (uint32_t)(uintptr_t)&fp->sf_si;
@ -334,7 +337,6 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
frame.sf_uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink;
frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.50 2018/01/24 09:04:44 skrll Exp $ */
/* $NetBSD: sig_machdep.c,v 1.51 2018/11/27 14:09:53 maxv Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -44,7 +44,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.50 2018/01/24 09:04:44 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.51 2018/11/27 14:09:53 maxv Exp $");
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
#include <sys/cpu.h>
@ -105,13 +105,13 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp = (struct sigframe_siginfo *)STACK_ALIGN(fp, STACK_ALIGNBYTES);
/* populate the siginfo frame */
memset(&frame, 0, sizeof(frame));
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_flags = _UC_SIGMASK;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = l->l_ctxlink;
frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.25 2011/02/08 20:20:15 rmind Exp $ */
/* $NetBSD: sig_machdep.c,v 1.26 2018/11/27 14:09:53 maxv Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.25 2011/02/08 20:20:15 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.26 2018/11/27 14:09:53 maxv Exp $");
#include "opt_compat_netbsd.h"
@ -141,13 +141,13 @@ sendsig_siginfo(const struct ksiginfo *ksi, const sigset_t *mask)
break;
}
memset(&frame, 0, sizeof(frame));
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_flags = _UC_SIGMASK |
((l->l_sigstk.ss_flags & SS_ONSTACK) ?
_UC_SETSTACK : _UC_CLRSTACK);
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_link = l->l_ctxlink;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &frame.sf_uc.uc_mcontext, &frame.sf_uc.uc_flags);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.812 2018/10/18 04:22:22 cherry Exp $ */
/* $NetBSD: machdep.c,v 1.813 2018/11/27 14:09:53 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.812 2018/10/18 04:22:22 cherry Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.813 2018/11/27 14:09:53 maxv Exp $");
#include "opt_beep.h"
#include "opt_compat_freebsd.h"
@ -689,6 +689,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp--;
memset(&frame, 0, sizeof(frame));
frame.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
frame.sf_signum = sig;
frame.sf_sip = &fp->sf_si;
@ -699,7 +700,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
frame.sf_uc.uc_link = l->l_ctxlink;
frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.49 2012/05/21 14:15:18 martin Exp $ */
/* $NetBSD: sig_machdep.c,v 1.50 2018/11/27 14:09:54 maxv Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -40,7 +40,7 @@
#include "opt_m68k_arch.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.49 2012/05/21 14:15:18 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.50 2018/11/27 14:09:54 maxv Exp $");
#define __M68K_SIGNAL_PRIVATE
@ -159,6 +159,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp--;
memset(&kf, 0, sizeof(kf));
kf.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
kf.sf_signum = sig;
kf.sf_sip = &fp->sf_si;
@ -169,7 +170,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
kf.sf_uc.uc_link = l->l_ctxlink;
kf.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK;
memset(&kf.sf_uc.uc_stack, 0, sizeof(kf.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &kf.sf_uc.uc_mcontext, &kf.sf_uc.uc_flags);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.15 2017/10/31 12:37:23 martin Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.16 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.15 2017/10/31 12:37:23 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.16 2018/11/27 14:09:54 maxv Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@ -177,6 +177,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
sfp--;
memset(&sf, 0, sizeof(sf));
netbsd32_si_to_si32(&sf.sf_si, (const siginfo_t *)&ksi->ksi_info);
/* Build stack frame for signal trampoline. */
@ -196,7 +197,6 @@ netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
? _UC_SETSTACK : _UC_CLRSTACK);
sf.sf_uc.uc_sigmask = *mask;
sf.sf_uc.uc_link = (intptr_t)l->l_ctxlink;
memset(&sf.sf_uc.uc_stack, 0, sizeof(sf.sf_uc.uc_stack));
sfsz = offsetof(struct sigframe_siginfo32, sf_uc.uc_mcontext);
if (p->p_md.md_abi == _MIPS_BSD_API_O32)
sfsz += sizeof(mcontext_o32_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.23 2011/07/10 23:21:59 matt Exp $ */
/* $NetBSD: sig_machdep.c,v 1.24 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.23 2011/07/10 23:21:59 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.24 2018/11/27 14:09:54 maxv Exp $");
#include "opt_cputype.h"
@ -85,12 +85,12 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
sf--;
memset(&ksf, 0, sizeof(ksf));
ksf.sf_si._info = ksi->ksi_info;
ksf.sf_uc.uc_flags = _UC_SIGMASK
| (l->l_sigstk.ss_flags & SS_ONSTACK ? _UC_SETSTACK : _UC_CLRSTACK);
ksf.sf_uc.uc_sigmask = *mask;
ksf.sf_uc.uc_link = l->l_ctxlink;
memset(&ksf.sf_uc.uc_stack, 0, sizeof(ksf.sf_uc.uc_stack));
sendsig_reset(l, signo);
mutex_exit(p->p_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.45 2017/03/05 16:09:26 chs Exp $ */
/* $NetBSD: sig_machdep.c,v 1.46 2018/11/27 14:09:54 maxv Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.45 2017/03/05 16:09:26 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.46 2018/11/27 14:09:54 maxv Exp $");
#include "opt_ppcarch.h"
#include "opt_altivec.h"
@ -89,10 +89,10 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
sp &= ~(CALLFRAMELEN-1);
/* Save register context. */
memset(&uc, 0, sizeof(uc));
uc.uc_flags = _UC_SIGMASK;
uc.uc_sigmask = *mask;
uc.uc_link = l->l_ctxlink;
memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
sendsig_reset(l, ksi->ksi_signo);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);

View File

@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef COMPATNAME1
__RCSID("$NetBSD: sig_machdep.c,v 1.1 2015/03/28 16:13:56 matt Exp $");
__RCSID("$NetBSD: sig_machdep.c,v 1.2 2018/11/27 14:09:54 maxv Exp $");
#endif
#include <sys/param.h>
@ -93,6 +93,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
sf--; // allocate sigframe
memset(&ksf, 0, sizeof(ksf));
COPY_SIGINFO(&ksf, ksi);
ksf.sf_uc.uc_flags = _UC_SIGMASK
| (l->l_sigstk.ss_flags & SS_ONSTACK ? _UC_SETSTACK : _UC_CLRSTACK);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sh3_machdep.c,v 1.105 2016/12/22 14:47:59 cherry Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.106 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.105 2016/12/22 14:47:59 cherry Exp $");
__KERNEL_RCSID(0, "$NetBSD: sh3_machdep.c,v 1.106 2018/11/27 14:09:54 maxv Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -361,13 +361,13 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp = getframe(l, sig, &onstack);
--fp;
memset(&frame, 0, sizeof(frame));
frame.sf_si._info = ksi->ksi_info;
frame.sf_uc.uc_link = l->l_ctxlink;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_flags = _UC_SIGMASK;
frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK;
memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &frame.sf_uc.uc_mcontext, &frame.sf_uc.uc_flags);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.288 2018/09/03 16:29:28 riastradh Exp $ */
/* $NetBSD: machdep.c,v 1.289 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.288 2018/09/03 16:29:28 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.289 2018/11/27 14:09:54 maxv Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -451,12 +451,12 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
/* Allocate an aligned sigframe */
fp = (void *)((u_long)(fp - 1) & ~0x0f);
memset(&uc, 0, sizeof(uc));
uc.uc_flags = _UC_SIGMASK |
((l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK);
uc.uc_sigmask = *mask;
uc.uc_link = l->l_ctxlink;
memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
sendsig_reset(l, sig);
mutex_exit(p->p_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.110 2016/10/19 09:44:01 skrll Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.110 2016/10/19 09:44:01 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.111 2018/11/27 14:09:54 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -212,6 +212,7 @@ netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
* and then copy it out. We probably ought to just build it
* directly in user space....
*/
memset(&sf, 0, sizeof(sf));
sf.sf_signo = sig;
sf.sf_code = (u_int)ksi->ksi_trap;
#if defined(COMPAT_SUNOS) || defined(MODULAR)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_i386.c,v 1.7 2018/06/06 01:49:08 maya Exp $ */
/* $NetBSD: cpu_i386.c,v 1.8 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud@netbsd.org>
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu_i386.c,v 1.7 2018/06/06 01:49:08 maya Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu_i386.c,v 1.8 2018/11/27 14:09:54 maxv Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@ -131,6 +131,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp--;
/* set up stack frame */
memset(&frame, 0, sizeof(frame));
frame.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
frame.sf_signum = sig;
frame.sf_sip = &fp->sf_si;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_x86_64.c,v 1.6 2018/06/06 01:49:08 maya Exp $ */
/* $NetBSD: cpu_x86_64.c,v 1.7 2018/11/27 14:09:54 maxv Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud@netbsd.org>
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.6 2018/06/06 01:49:08 maya Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.7 2018/11/27 14:09:54 maxv Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@ -132,6 +132,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
fp = (struct sigframe_siginfo *) (((unsigned long)sp & ~15) - 8);
/* set up stack frame */
memset(&frame, 0, sizeof(frame));
frame.sf_ra = (uint64_t) ps->sa_sigdesc[sig].sd_tramp;
frame.sf_si._info = ksi->ksi_info;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.22 2017/05/22 16:53:05 ragge Exp $ */
/* $NetBSD: sig_machdep.c,v 1.23 2018/11/27 14:09:54 maxv Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.22 2017/05/22 16:53:05 ragge Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.23 2018/11/27 14:09:54 maxv Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@ -160,6 +160,7 @@ setupstack_siginfo3(const struct ksiginfo *ksi, const sigset_t *mask, int vers,
/*
* Arguments given to the signal handler.
*/
memset(&tramp, 0, sizeof(tramp));
tramp.narg = 3;
tramp.sig = ksi->ksi_signo;
sp -= sizeof(uc); tramp.ucp = sp;
@ -167,10 +168,10 @@ setupstack_siginfo3(const struct ksiginfo *ksi, const sigset_t *mask, int vers,
sp -= sizeof(tramp);
/* Save register context. */
memset(&uc, 0, sizeof(uc));
uc.uc_flags = _UC_SIGMASK;
uc.uc_sigmask = *mask;
uc.uc_link = l->l_ctxlink;
memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
sendsig_reset(l, ksi->ksi_signo);
mutex_exit(p->p_lock);
cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);