Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/altq Pull up following revision(s) (requested by rias...



details:   https://anonhg.NetBSD.org/src/rev/ff01cafb1601
branches:  netbsd-8
changeset: 376546:ff01cafb1601
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jun 21 20:15:53 2023 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1831):

        sys/altq/altq_hfsc.c: revision 1.29
        sys/altq/altq_priq.c: revision 1.27

sys/altq: 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:

 sys/altq/altq_hfsc.c |  5 +++--
 sys/altq/altq_priq.c |  7 +++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r aa44aad9d56a -r ff01cafb1601 sys/altq/altq_hfsc.c
--- a/sys/altq/altq_hfsc.c      Wed Jun 21 19:54:02 2023 +0000
+++ b/sys/altq/altq_hfsc.c      Wed Jun 21 20:15:53 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_hfsc.c,v 1.26.10.1 2017/08/09 05:31:02 snj Exp $  */
+/*     $NetBSD: altq_hfsc.c,v 1.26.10.2 2023/06/21 20:15:53 martin Exp $       */
 /*     $KAME: altq_hfsc.c,v 1.26 2005/04/13 03:44:24 suz Exp $ */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.26.10.1 2017/08/09 05:31:02 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.26.10.2 2023/06/21 20:15:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -2182,6 +2182,7 @@ hfsccmd_class_stats(struct hfsc_class_st
        usp = ap->stats;
        for (n = 0; cl != NULL && n < nclasses; cl = hfsc_nextclass(cl), n++) {
 
+               memset(&stats, 0, sizeof(stats));
                get_class_stats(&stats, cl);
 
                if ((error = copyout((void *)&stats, (void *)usp++,
diff -r aa44aad9d56a -r ff01cafb1601 sys/altq/altq_priq.c
--- a/sys/altq/altq_priq.c      Wed Jun 21 19:54:02 2023 +0000
+++ b/sys/altq/altq_priq.c      Wed Jun 21 20:15:53 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_priq.c,v 1.23.10.1 2017/08/09 05:31:02 snj Exp $  */
+/*     $NetBSD: altq_priq.c,v 1.23.10.2 2023/06/21 20:15:53 martin Exp $       */
 /*     $KAME: altq_priq.c,v 1.13 2005/04/13 03:44:25 suz Exp $ */
 /*
  * Copyright (C) 2000-2003
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.23.10.1 2017/08/09 05:31:02 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.23.10.2 2023/06/21 20:15:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -972,10 +972,9 @@ priqcmd_class_stats(struct priq_class_st
        usp = ap->stats;
        for (pri = 0; pri <= pif->pif_maxpri; pri++) {
                cl = pif->pif_classes[pri];
+               memset(&stats, 0, sizeof(stats));
                if (cl != NULL)
                        get_class_stats(&stats, cl);
-               else
-                       memset(&stats, 0, sizeof(stats));
                if ((error = copyout((void *)&stats, (void *)usp++,
                                     sizeof(stats))) != 0)
                        return (error);



Home | Main Index | Thread Index | Old Index