Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/5167ef8ef9f2
branches:  netbsd-8
changeset: 933482:5167ef8ef9f2
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 25 17:48:16 2020 +0000

description:
Pull up following revision(s) (requested by christos in ticket #1549):

        sys/netinet/igmp.c: revision 1.70
        sys/kern/kern_time.c: revision 1.204

igmp_sendpkt() expects ip_output() to set 'imo.imo_multicast_ttl' into
'ip->ip_ttl'; but ip_output() won't if the target is not a multicast
address, meaning that the uninitialized 'ip->ip_ttl' byte gets sent to
the network. This leaks one byte of kernel heap.

Fix this by filling 'ip->ip_ttl' with a TTL of one.
Found by KMSAN.

 -

Fix uninitialized memory access. Found by KMSAN.

diffstat:

 sys/kern/kern_time.c |  10 +++++++---
 sys/netinet/igmp.c   |   5 +++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (58 lines):

diff -r 3915f3dbbb05 -r 5167ef8ef9f2 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Wed May 13 12:40:09 2020 +0000
+++ b/sys/kern/kern_time.c      Mon May 25 17:48:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.189.8.5 2019/02/24 10:49:53 martin Exp $       */
+/*     $NetBSD: kern_time.c,v 1.189.8.6 2020/05/25 17:48:16 martin Exp $       */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189.8.5 2019/02/24 10:49:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189.8.6 2020/05/25 17:48:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -354,8 +354,12 @@
                struct timespec rmtend;
                struct timespec t0;
                struct timespec *t;
+               int err;
 
-               (void)clock_gettime1(clock_id, &rmtend);
+               err = clock_gettime1(clock_id, &rmtend);
+               if (err != 0)
+                       return err;
+
                t = (rmt != NULL) ? rmt : &t0;
                if (flags & TIMER_ABSTIME) {
                        timespecsub(rqt, &rmtend, t);
diff -r 3915f3dbbb05 -r 5167ef8ef9f2 sys/netinet/igmp.c
--- a/sys/netinet/igmp.c        Wed May 13 12:40:09 2020 +0000
+++ b/sys/netinet/igmp.c        Mon May 25 17:48:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igmp.c,v 1.64.6.2 2018/07/13 14:26:47 martin Exp $     */
+/*     $NetBSD: igmp.c,v 1.64.6.3 2020/05/25 17:48:16 martin Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64.6.2 2018/07/13 14:26:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64.6.3 2020/05/25 17:48:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -620,6 +620,7 @@
        ip->ip_tos = 0;
        ip->ip_len = htons(sizeof(struct ip) + IGMP_MINLEN);
        ip->ip_off = htons(0);
+       ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL;
        ip->ip_p = IPPROTO_IGMP;
        ip->ip_src = zeroin_addr;
        ip->ip_dst = inm->inm_addr;



Home | Main Index | Thread Index | Old Index