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 knakahara...



details:   https://anonhg.NetBSD.org/src/rev/77ecc8af382a
branches:  netbsd-8
changeset: 435001:77ecc8af382a
user:      martin <martin%NetBSD.org@localhost>
date:      Thu May 17 14:07:03 2018 +0000

description:
Pull up following revision(s) (requested by knakahara in ticket #829):

        sys/net/if_l2tp.c: revision 1.24
        sys/net/if_ipsec.c: revision 1.13
        sys/net/if_gif.h: revision 1.31
        sys/netipsec/ipsecif.c: revision 1.8
        sys/net/if_gif.c: revision 1.140
        sys/netinet6/in6_l2tp.c: revision 1.15
        sys/net/if_ipsec.h: revision 1.3
        sys/netinet6/in6_gif.c: revision 1.92
        sys/net/if_l2tp.h: revision 1.5
        sys/netinet/in_l2tp.c: revision 1.13
        sys/netinet/in_gif.c: revision 1.93

Fix LOCKDEBUG kernel panic when many(about 200) tunnel interfaces is created.

The tunnel interfaces are gif(4), l2tp(4), and ipsecif(4). They use mutex
itself in percpu area. When percpu_cpu_enlarge() run, the address of the
mutex in percpu area becomes different from the address which lockdebug
saved. That can cause "already initialized" false detection.

diffstat:

 sys/net/if_gif.c        |   8 ++++----
 sys/net/if_gif.h        |   4 ++--
 sys/net/if_ipsec.c      |   8 ++++----
 sys/net/if_ipsec.h      |   4 ++--
 sys/net/if_l2tp.c       |   8 ++++----
 sys/net/if_l2tp.h       |   4 ++--
 sys/netinet/in_gif.c    |  12 ++++++------
 sys/netinet/in_l2tp.c   |  12 ++++++------
 sys/netinet6/in6_gif.c  |  12 ++++++------
 sys/netinet6/in6_l2tp.c |  12 ++++++------
 sys/netipsec/ipsecif.c  |  20 ++++++++++----------
 11 files changed, 52 insertions(+), 52 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_gif.c
--- a/sys/net/if_gif.c  Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_gif.c  Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.c,v 1.126.2.9 2018/03/08 13:22:26 martin Exp $  */
+/*     $NetBSD: if_gif.c,v 1.126.2.10 2018/05/17 14:07:03 martin Exp $ */
 /*     $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $    */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.9 2018/03/08 13:22:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.10 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -319,7 +319,7 @@
 {
        struct gif_ro *gro = p;
 
-       mutex_init(&gro->gr_lock, MUTEX_DEFAULT, IPL_NONE);
+       gro->gr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
 static void
@@ -329,7 +329,7 @@
 
        rtcache_free(&gro->gr_ro);
 
-       mutex_destroy(&gro->gr_lock);
+       mutex_obj_free(gro->gr_lock);
 }
 
 void
diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_gif.h
--- a/sys/net/if_gif.h  Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_gif.h  Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.h,v 1.25.8.2 2018/01/02 10:48:51 snj Exp $      */
+/*     $NetBSD: if_gif.h,v 1.25.8.3 2018/05/17 14:07:03 martin Exp $   */
 /*     $KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $ */
 
 /*
@@ -56,7 +56,7 @@
 
 struct gif_ro {
        struct route gr_ro;
-       kmutex_t gr_lock;
+       kmutex_t *gr_lock;
 };
 
 struct gif_variant {
diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c        Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_ipsec.c        Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $  */
+/*     $NetBSD: if_ipsec.c,v 1.3.2.7 2018/05/17 14:07:03 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.7 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -220,7 +220,7 @@
 {
        struct ipsec_ro *iro = p;
 
-       mutex_init(&iro->ir_lock, MUTEX_DEFAULT, IPL_NONE);
+       iro->ir_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
 static void
@@ -230,7 +230,7 @@
 
        rtcache_free(&iro->ir_ro);
 
-       mutex_destroy(&iro->ir_lock);
+       mutex_obj_free(iro->ir_lock);
 }
 
 static int
diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_ipsec.h
--- a/sys/net/if_ipsec.h        Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_ipsec.h        Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.h,v 1.1.2.2 2018/02/11 21:17:34 snj Exp $  */
+/*     $NetBSD: if_ipsec.h,v 1.1.2.3 2018/05/17 14:07:03 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -87,7 +87,7 @@
 
 struct ipsec_ro {
        struct route ir_ro;
-       kmutex_t ir_lock;
+       kmutex_t *ir_lock;
 };
 
 struct ipsec_softc {
diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_l2tp.c
--- a/sys/net/if_l2tp.c Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_l2tp.c Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_l2tp.c,v 1.11.2.7 2018/04/11 14:15:45 martin Exp $  */
+/*     $NetBSD: if_l2tp.c,v 1.11.2.8 2018/05/17 14:07:03 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.7 2018/04/11 14:15:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.11.2.8 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -298,7 +298,7 @@
 {
        struct l2tp_ro *lro = p;
 
-       mutex_init(&lro->lr_lock, MUTEX_DEFAULT, IPL_NONE);
+       lro->lr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
 void
@@ -308,7 +308,7 @@
 
        rtcache_free(&lro->lr_ro);
 
-       mutex_destroy(&lro->lr_lock);
+       mutex_obj_free(lro->lr_lock);
 }
 
 static int
diff -r 042988fa0901 -r 77ecc8af382a sys/net/if_l2tp.h
--- a/sys/net/if_l2tp.h Thu May 17 14:02:31 2018 +0000
+++ b/sys/net/if_l2tp.h Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_l2tp.h,v 1.2.2.1 2018/03/08 13:41:40 martin Exp $   */
+/*     $NetBSD: if_l2tp.h,v 1.2.2.2 2018/05/17 14:07:03 martin Exp $   */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -92,7 +92,7 @@
 
 struct l2tp_ro {
        struct route lr_ro;
-       kmutex_t lr_lock;
+       kmutex_t *lr_lock;
 };
 
 struct l2tp_softc {
diff -r 042988fa0901 -r 77ecc8af382a sys/netinet/in_gif.c
--- a/sys/netinet/in_gif.c      Thu May 17 14:02:31 2018 +0000
+++ b/sys/netinet/in_gif.c      Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_gif.c,v 1.87.8.4 2018/02/11 21:17:34 snj Exp $      */
+/*     $NetBSD: in_gif.c,v 1.87.8.5 2018/05/17 14:07:04 martin Exp $   */
 /*     $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.87.8.4 2018/02/11 21:17:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.87.8.5 2018/05/17 14:07:04 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -176,10 +176,10 @@
 
        sc = var->gv_softc;
        gro = percpu_getref(sc->gif_ro_percpu);
-       mutex_enter(&gro->gr_lock);
+       mutex_enter(gro->gr_lock);
        ro = &gro->gr_ro;
        if ((rt = rtcache_lookup(ro, var->gv_pdst)) == NULL) {
-               mutex_exit(&gro->gr_lock);
+               mutex_exit(gro->gr_lock);
                percpu_putref(sc->gif_ro_percpu);
                m_freem(m);
                return ENETUNREACH;
@@ -189,7 +189,7 @@
        if (rt->rt_ifp == ifp) {
                rtcache_unref(rt, ro);
                rtcache_free(ro);
-               mutex_exit(&gro->gr_lock);
+               mutex_exit(gro->gr_lock);
                percpu_putref(sc->gif_ro_percpu);
                m_freem(m);
                return ENETUNREACH;     /*XXX*/
@@ -197,7 +197,7 @@
        rtcache_unref(rt, ro);
 
        error = ip_output(m, NULL, ro, 0, NULL, NULL);
-       mutex_exit(&gro->gr_lock);
+       mutex_exit(gro->gr_lock);
        percpu_putref(sc->gif_ro_percpu);
        return (error);
 }
diff -r 042988fa0901 -r 77ecc8af382a sys/netinet/in_l2tp.c
--- a/sys/netinet/in_l2tp.c     Thu May 17 14:02:31 2018 +0000
+++ b/sys/netinet/in_l2tp.c     Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_l2tp.c,v 1.2.8.4 2018/03/08 13:41:41 martin Exp $   */
+/*     $NetBSD: in_l2tp.c,v 1.2.8.5 2018/05/17 14:07:03 martin Exp $   */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.4 2018/03/08 13:41:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.5 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -209,9 +209,9 @@
        memcpy(mtod(m, struct ip *), &iphdr, sizeof(struct ip));
 
        lro = percpu_getref(sc->l2tp_ro_percpu);
-       mutex_enter(&lro->lr_lock);
+       mutex_enter(lro->lr_lock);
        if ((rt = rtcache_lookup(&lro->lr_ro, var->lv_pdst)) == NULL) {
-               mutex_exit(&lro->lr_lock);
+               mutex_exit(lro->lr_lock);
                percpu_putref(sc->l2tp_ro_percpu);
                m_freem(m);
                error = ENETUNREACH;
@@ -221,7 +221,7 @@
        if (rt->rt_ifp == ifp) {
                rtcache_unref(rt, &lro->lr_ro);
                rtcache_free(&lro->lr_ro);
-               mutex_exit(&lro->lr_lock);
+               mutex_exit(lro->lr_lock);
                percpu_putref(sc->l2tp_ro_percpu);
                m_freem(m);
                error = ENETUNREACH;    /*XXX*/
@@ -236,7 +236,7 @@
        m->m_pkthdr.csum_flags  = 0;
 
        error = ip_output(m, NULL, &lro->lr_ro, 0, NULL, NULL);
-       mutex_exit(&lro->lr_lock);
+       mutex_exit(lro->lr_lock);
        percpu_putref(sc->l2tp_ro_percpu);
        return error;
 
diff -r 042988fa0901 -r 77ecc8af382a sys/netinet6/in6_gif.c
--- a/sys/netinet6/in6_gif.c    Thu May 17 14:02:31 2018 +0000
+++ b/sys/netinet6/in6_gif.c    Thu May 17 14:07:03 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_gif.c,v 1.85.6.5 2018/03/15 11:27:25 bouyer Exp $  */
+/*     $NetBSD: in6_gif.c,v 1.85.6.6 2018/05/17 14:07:03 martin Exp $  */
 /*     $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.85.6.5 2018/03/15 11:27:25 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.85.6.6 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -182,11 +182,11 @@
 
        sc = ifp->if_softc;
        gro = percpu_getref(sc->gif_ro_percpu);
-       mutex_enter(&gro->gr_lock);
+       mutex_enter(gro->gr_lock);
        ro = &gro->gr_ro;
        rt = rtcache_lookup(ro, var->gv_pdst);
        if (rt == NULL) {
-               mutex_exit(&gro->gr_lock);
+               mutex_exit(gro->gr_lock);
                percpu_putref(sc->gif_ro_percpu);
                m_freem(m);
                return ENETUNREACH;
@@ -196,7 +196,7 @@
        if (rt->rt_ifp == ifp) {
                rtcache_unref(rt, ro);
                rtcache_free(ro);
-               mutex_exit(&gro->gr_lock);
+               mutex_exit(gro->gr_lock);
                percpu_putref(sc->gif_ro_percpu);
                m_freem(m);
                return ENETUNREACH;     /* XXX */



Home | Main Index | Thread Index | Old Index