Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/d25078d9e448
branches:  netbsd-9
changeset: 368769:d25078d9e448
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 03 11:01:51 2022 +0000

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

        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 d30974aad2cb -r d25078d9e448 sys/altq/altq_hfsc.c
--- a/sys/altq/altq_hfsc.c      Wed Aug 03 10:58:58 2022 +0000
+++ b/sys/altq/altq_hfsc.c      Wed Aug 03 11:01:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_hfsc.c,v 1.28 2018/11/15 10:23:55 maxv Exp $      */
+/*     $NetBSD: altq_hfsc.c,v 1.28.4.1 2022/08/03 11:01:51 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.28 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.28.4.1 2022/08/03 11:01:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -2182,6 +2182,7 @@
        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 d30974aad2cb -r d25078d9e448 sys/altq/altq_priq.c
--- a/sys/altq/altq_priq.c      Wed Aug 03 10:58:58 2022 +0000
+++ b/sys/altq/altq_priq.c      Wed Aug 03 11:01:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: altq_priq.c,v 1.26 2018/11/15 10:23:55 maxv Exp $      */
+/*     $NetBSD: altq_priq.c,v 1.26.4.1 2022/08/03 11:01:51 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.26 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.26.4.1 2022/08/03 11:01:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq.h"
@@ -958,10 +958,9 @@
        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