Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix kernel info leak, 4 bytes of padding at the end...



details:   https://anonhg.NetBSD.org/src/rev/b728646b1b97
branches:  trunk
changeset: 837330:b728646b1b97
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Nov 29 10:27:36 2018 +0000

description:
Fix kernel info leak, 4 bytes of padding at the end of struct sigaction.

        + Possible info leak: [len=32, leaked=4]
        | #0 0xffffffff80baf327 in kleak_copyout
        | #1 0xffffffff80bd9ca8 in sys___sigaction_sigtramp
        | #2 0xffffffff80259c42 in syscall

diffstat:

 sys/kern/kern_sig.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 597e3f256f9a -r b728646b1b97 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Thu Nov 29 10:02:52 2018 +0000
+++ b/sys/kern/kern_sig.c       Thu Nov 29 10:27:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.349 2018/05/28 14:07:37 kamil Exp $     */
+/*     $NetBSD: kern_sig.c,v 1.350 2018/11/29 10:27:36 maxv Exp $      */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.349 2018/05/28 14:07:37 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.350 2018/11/29 10:27:36 maxv Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -190,6 +190,13 @@
        return result;
 }
 
+static int
+sigacts_ctor(void *arg __unused, void *obj, int flags __unused)
+{
+       memset(obj, 0, sizeof(struct sigacts));
+       return 0;
+}
+
 /*
  * signal_init:
  *
@@ -203,7 +210,7 @@
 
        sigacts_cache = pool_cache_init(sizeof(struct sigacts), 0, 0, 0,
            "sigacts", sizeof(struct sigacts) > PAGE_SIZE ?
-           &sigactspool_allocator : NULL, IPL_NONE, NULL, NULL, NULL);
+           &sigactspool_allocator : NULL, IPL_NONE, sigacts_ctor, NULL, NULL);
        ksiginfo_cache = pool_cache_init(sizeof(ksiginfo_t), 0, 0, 0,
            "ksiginfo", NULL, IPL_VM, NULL, NULL, NULL);
 



Home | Main Index | Thread Index | Old Index