summaryrefslogtreecommitdiff
path: root/sys/compat/linux32/arch
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-09-07 11:43:02 +0000
committerriastradh <riastradh@NetBSD.org>2021-09-07 11:43:02 +0000
commitd50c96bb491810004b0fd3ea08acbff05abd6140 (patch)
treee16d154152093b1cf3e149fd08f9ae1198e78a9e /sys/compat/linux32/arch
parent8c28c0027cf16b13c944b0927bedb3108488033d (diff)
sys/compat: Memset zero before copyout.
Just in case of uninitialized padding which would lead to kernel stack disclosure. If the compiler can prove the memset redundant then it can optimize it away; otherwise better safe than sorry.
Diffstat (limited to 'sys/compat/linux32/arch')
-rw-r--r--sys/compat/linux32/arch/amd64/linux32_machdep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/compat/linux32/arch/amd64/linux32_machdep.c b/sys/compat/linux32/arch/amd64/linux32_machdep.c
index 70a9ac2e3fb..31843580fb1 100644
--- a/sys/compat/linux32/arch/amd64/linux32_machdep.c
+++ b/sys/compat/linux32/arch/amd64/linux32_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_machdep.c,v 1.45 2019/05/19 08:46:15 maxv Exp $ */
+/* $NetBSD: linux32_machdep.c,v 1.46 2021/09/07 11:43:04 riastradh Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,7 +31,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.45 2019/05/19 08:46:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_machdep.c,v 1.46 2021/09/07 11:43:04 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_user_ldt.h"
@@ -126,6 +126,8 @@ linux32_old_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
DPRINTF(("old: onstack = %d, fp = %p sig = %d rip = 0x%lx\n",
onstack, fp, sig, tf->tf_rip));
+ memset(&frame, 0, sizeof(frame));
+
/* Build stack frame for signal trampoline. */
NETBSD32PTR32(frame.sf_handler, catcher);
frame.sf_sig = native_to_linux32_signo[sig];