Source-Changes-HG archive

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

[src/trunk]: src/sys/kern entropy: Don't disclose stack garbage in kern.entro...



details:   https://anonhg.NetBSD.org/src/rev/af50255955c6
branches:  trunk
changeset: 368796:af50255955c6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Aug 05 23:43:46 2022 +0000

description:
entropy: Don't disclose stack garbage in kern.entropy sysctls.

kern.entropy.consolidate and kern.entropy.gather are supposed to be
write-only -- it doesn't make any sense to read from them, but I
suppose it's better to read-as-zero than read-as-stack-secrets!

diffstat:

 sys/kern/kern_entropy.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r ab147bf0b8b2 -r af50255955c6 sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Fri Aug 05 21:03:43 2022 +0000
+++ b/sys/kern/kern_entropy.c   Fri Aug 05 23:43:46 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_entropy.c,v 1.56 2022/05/13 09:40:02 riastradh Exp $      */
+/*     $NetBSD: kern_entropy.c,v 1.57 2022/08/05 23:43:46 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.56 2022/05/13 09:40:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.57 2022/08/05 23:43:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1291,7 +1291,7 @@
 sysctl_entropy_consolidate(SYSCTLFN_ARGS)
 {
        struct sysctlnode node = *rnode;
-       int arg;
+       int arg = 0;
        int error;
 
        KASSERT(E->stage == ENTROPY_HOT);
@@ -1317,7 +1317,7 @@
 sysctl_entropy_gather(SYSCTLFN_ARGS)
 {
        struct sysctlnode node = *rnode;
-       int arg;
+       int arg = 0;
        int error;
 
        KASSERT(E->stage == ENTROPY_HOT);



Home | Main Index | Thread Index | Old Index