Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/arch Pull up following revision(s) (requested by maxv...
details: https://anonhg.NetBSD.org/src/rev/33858b77cbbf
branches: netbsd-8
changeset: 447905:33858b77cbbf
user: martin <martin%NetBSD.org@localhost>
date: Sun Jan 27 18:43:08 2019 +0000
description:
Pull up following revision(s) (requested by maxv in ticket #1173):
sys/arch/hppa/hppa/sig_machdep.c: revision 1.26
sys/arch/arm/arm/sig_machdep.c: revision 1.51
sys/arch/i386/i386/machdep.c: revision 1.813
sys/arch/alpha/alpha/machdep.c: revision 1.352
sys/arch/m68k/m68k/sig_machdep.c: revision 1.50
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.8
sys/arch/sparc64/sparc64/machdep.c: revision 1.289
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.111
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.46
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.117
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.106
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.16
sys/arch/mips/mips/sig_machdep.c: revision 1.24
sys/arch/riscv/riscv/sig_machdep.c: revision 1.2
sys/arch/usermode/target/x86_64/cpu_x86_64.c: revision 1.7
sys/arch/vax/vax/sig_machdep.c: revision 1.23
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.
diffstat:
sys/arch/alpha/alpha/machdep.c | 7 +++----
sys/arch/amd64/amd64/netbsd32_machdep.c | 8 +++++---
sys/arch/arm/arm/sig_machdep.c | 6 +++---
sys/arch/hppa/hppa/sig_machdep.c | 6 +++---
sys/arch/i386/i386/machdep.c | 6 +++---
sys/arch/m68k/m68k/sig_machdep.c | 6 +++---
sys/arch/mips/mips/netbsd32_machdep.c | 6 +++---
sys/arch/mips/mips/sig_machdep.c | 6 +++---
sys/arch/powerpc/powerpc/sig_machdep.c | 6 +++---
sys/arch/riscv/riscv/sig_machdep.c | 3 ++-
sys/arch/sh3/sh3/sh3_machdep.c | 6 +++---
sys/arch/sparc64/sparc64/machdep.c | 6 +++---
sys/arch/sparc64/sparc64/netbsd32_machdep.c | 5 +++--
sys/arch/usermode/target/i386/cpu_i386.c | 5 +++--
sys/arch/usermode/target/x86_64/cpu_x86_64.c | 5 +++--
sys/arch/vax/vax/sig_machdep.c | 7 ++++---
16 files changed, 50 insertions(+), 44 deletions(-)
diffs (truncated from 506 to 300 lines):
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.350 2017/03/16 16:13:20 chs Exp $ */
+/* $NetBSD: machdep.c,v 1.350.6.1 2019/01/27 18:43:08 martin 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.350 2017/03/16 16:13:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350.6.1 2019/01/27 18:43:08 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1467,12 +1467,11 @@
#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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.105.2.1 2017/12/21 19:53:28 snj Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.105.2.2 2019/01/27 18:43:08 martin Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.105.2.1 2017/12/21 19:53:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.105.2.2 2019/01/27 18:43:08 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -229,6 +229,8 @@
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:
@@ -328,6 +330,7 @@
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;
@@ -338,7 +341,6 @@
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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/arm/arm/sig_machdep.c
--- a/sys/arch/arm/arm/sig_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/arm/arm/sig_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.49 2015/03/24 08:38:29 matt Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.49.10.1 2019/01/27 18:43:08 martin Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.49 2015/03/24 08:38:29 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.49.10.1 2019/01/27 18:43:08 martin Exp $");
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
#include <sys/cpu.h>
@@ -107,13 +107,13 @@
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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/hppa/hppa/sig_machdep.c
--- a/sys/arch/hppa/hppa/sig_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/hppa/hppa/sig_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -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.25.48.1 2019/01/27 18:43:08 martin 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.25.48.1 2019/01/27 18:43:08 martin Exp $");
#include "opt_compat_netbsd.h"
@@ -141,13 +141,13 @@
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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/i386/i386/machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.782.6.6 2018/06/09 15:12:21 martin Exp $ */
+/* $NetBSD: machdep.c,v 1.782.6.7 2019/01/27 18:43:08 martin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.782.6.6 2018/06/09 15:12:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.782.6.7 2019/01/27 18:43:08 martin Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -739,6 +739,7 @@
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;
@@ -749,7 +750,6 @@
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));
if (tf->tf_eflags & PSL_VM)
(*p->p_emul->e_syscall_intern)(p);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/m68k/m68k/sig_machdep.c
--- a/sys/arch/m68k/m68k/sig_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/m68k/m68k/sig_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -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.49.32.1 2019/01/27 18:43:08 martin 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.49.32.1 2019/01/27 18:43:08 martin Exp $");
#define __M68K_SIGNAL_PRIVATE
@@ -159,6 +159,7 @@
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 @@
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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/mips/mips/netbsd32_machdep.c
--- a/sys/arch/mips/mips/netbsd32_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/mips/mips/netbsd32_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.14 2017/03/16 16:13:20 chs Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.14.6.1 2019/01/27 18:43:09 martin 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.14 2017/03/16 16:13:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.14.6.1 2019/01/27 18:43:09 martin Exp $");
#include "opt_compat_netbsd.h"
#include "opt_coredump.h"
@@ -177,6 +177,7 @@
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 @@
? _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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/mips/mips/sig_machdep.c
--- a/sys/arch/mips/mips/sig_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/mips/mips/sig_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -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.23.46.1 2019/01/27 18:43:09 martin 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.23.46.1 2019/01/27 18:43:09 martin Exp $");
#include "opt_cputype.h"
@@ -85,12 +85,12 @@
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);
diff -r 2d74538628a1 -r 33858b77cbbf sys/arch/powerpc/powerpc/sig_machdep.c
--- a/sys/arch/powerpc/powerpc/sig_machdep.c Sun Jan 27 18:35:19 2019 +0000
+++ b/sys/arch/powerpc/powerpc/sig_machdep.c Sun Jan 27 18:43:08 2019 +0000
@@ -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.45.6.1 2019/01/27 18:43:08 martin 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.45.6.1 2019/01/27 18:43:08 martin Exp $");
#include "opt_ppcarch.h"
#include "opt_altivec.h"
@@ -89,10 +89,10 @@
sp &= ~(CALLFRAMELEN-1);
/* Save register context. */
+ memset(&uc, 0, sizeof(uc));
uc.uc_flags = _UC_SIGMASK;
uc.uc_sigmask = *mask;
Home |
Main Index |
Thread Index |
Old Index