Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 Fix stack info leak. There is a big pad...



details:   https://anonhg.NetBSD.org/src/rev/ecbfaee94c60
branches:  trunk
changeset: 836890:ecbfaee94c60
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Nov 11 10:58:40 2018 +0000

description:
Fix stack info leak. There is a big padding in struct sigframe_siginfo.

[  224.006287] kleak: Possible leak in copyout: [len=920, leaked=92]
[  224.016977] #0 0xffffffff80224d0a in kleak_note <netbsd>
[  224.026268] #1 0xffffffff80224d8a in kleak_copyout <netbsd>
[  224.026268] #2 0xffffffff802224b5 in sendsig_siginfo <netbsd>
[  224.036261] #3 0xffffffff80b51564 in sendsig <netbsd>
[  224.046475] #4 0xffffffff80b51282 in postsig <netbsd>
[  224.046475] #5 0xffffffff80b2fc5d in lwp_userret <netbsd>
[  224.056273] #6 0xffffffff8025a951 in mi_userret <netbsd>
[  224.066277] #7 0xffffffff8025ab89 in syscall <netbsd>

diffstat:

 sys/arch/amd64/amd64/machdep.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r c2e4cba44dd6 -r ecbfaee94c60 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Sun Nov 11 10:55:58 2018 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Sun Nov 11 10:58:40 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.320 2018/10/31 06:26:25 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.321 2018/11/11 10:58:40 maxv Exp $       */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.320 2018/10/31 06:26:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.321 2018/11/11 10:58:40 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -626,6 +626,7 @@
        /* Round down the stackpointer to a multiple of 16 for the ABI. */
        fp = (struct sigframe_siginfo *)(((unsigned long)sp & ~15) - 8);
 
+       memset(&frame, 0, sizeof(frame));
        frame.sf_ra = (uint64_t)ps->sa_sigdesc[sig].sd_tramp;
        frame.sf_si._info = ksi->ksi_info;
        frame.sf_uc.uc_flags = _UC_SIGMASK;
@@ -633,7 +634,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));
        sendsig_reset(l, sig);
 
        mutex_exit(p->p_lock);



Home | Main Index | Thread Index | Old Index