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 ozaki-r i...



details:   https://anonhg.NetBSD.org/src/rev/9f55fe74f8e3
branches:  netbsd-8
changeset: 851261:9f55fe74f8e3
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Jan 02 10:56:58 2018 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #463):
        sys/netinet/in.c: revision 1.212
        sys/netinet/ip_output.c: revision 1.288
        sys/netinet6/in6.c: revision 1.256
        sys/netinet6/in6_pcb.c: revision 1.163
        sys/sys/lwp.h: revision 1.176
Add missing curlwp_bindx
--
Add missing curlwp_bindx
--
Check LP_BOUND is surely set in curlwp_bindx
This may find an extra call of curlwp_bindx.
--
Fix usage of curlwp_bind in ip_output
curlwp_bindx must be called in LIFO order, i.e., we can't call curlwp_bind
and curlwp_bindx like this:
  bound1 = curlwp_bind();
  bound2 = curlwp_bind();
  curlwp_bindx(bound1);
  curlwp_bindx(bound2);
ip_outout did so if NET_MPSAFE. Fix it.
--
Fix wrong usage of psref_held
We can't use it for checking if a caller does NOT hold a given target.
If you want to do it you should have psref_not_held or something.

diffstat:

 sys/netinet/in.c        |   6 +++---
 sys/netinet/ip_output.c |  10 ++++++----
 sys/netinet6/in6.c      |   6 +++---
 sys/netinet6/in6_pcb.c  |   6 ++++--
 sys/sys/lwp.h           |   4 +++-
 5 files changed, 19 insertions(+), 13 deletions(-)

diffs (144 lines):

diff -r 968588cecb24 -r 9f55fe74f8e3 sys/netinet/in.c
--- a/sys/netinet/in.c  Tue Jan 02 10:48:51 2018 +0000
+++ b/sys/netinet/in.c  Tue Jan 02 10:56:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.203.2.4 2018/01/02 10:20:34 snj Exp $ */
+/*     $NetBSD: in.c,v 1.203.2.5 2018/01/02 10:56:58 snj Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.203.2.4 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.203.2.5 2018/01/02 10:56:58 snj Exp $");
 
 #include "arp.h"
 
@@ -845,7 +845,7 @@
        struct in_ifaddr *ia = (void *) ifa;
        struct ifnet *ifp = ifa->ifa_ifp;
 
-       KASSERT(!ifa_held(ifa));
+       /* KASSERT(!ifa_held(ifa)); XXX need ifa_not_held (psref_not_held) */
 
        ifa->ifa_flags |= IFA_DESTROYING;
        in_scrubaddr(ia);
diff -r 968588cecb24 -r 9f55fe74f8e3 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Tue Jan 02 10:48:51 2018 +0000
+++ b/sys/netinet/ip_output.c   Tue Jan 02 10:56:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.279.2.3 2018/01/02 10:20:34 snj Exp $  */
+/*     $NetBSD: ip_output.c,v 1.279.2.4 2018/01/02 10:56:58 snj Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.279.2.3 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.279.2.4 2018/01/02 10:56:58 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -303,6 +303,10 @@
            !in_hosteq(dst->sin_addr, ip->ip_dst)))
                rtcache_free(ro);
 
+       /* XXX must be before rtcache operations */
+       bound = curlwp_bind();
+       bind_need_restore = true;
+
        if ((rt = rtcache_validate(ro)) == NULL &&
            (rt = rtcache_update(ro, 1)) == NULL) {
                dst = &udst.sin;
@@ -311,8 +315,6 @@
                        goto bad;
        }
 
-       bound = curlwp_bind();
-       bind_need_restore = true;
        /*
         * If routing to interface only, short circuit routing lookup.
         */
diff -r 968588cecb24 -r 9f55fe74f8e3 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Tue Jan 02 10:48:51 2018 +0000
+++ b/sys/netinet6/in6.c        Tue Jan 02 10:56:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.245.2.4 2018/01/02 10:20:34 snj Exp $        */
+/*     $NetBSD: in6.c,v 1.245.2.5 2018/01/02 10:56:58 snj Exp $        */
 /*     $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $   */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.4 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.5 2018/01/02 10:56:58 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1384,7 +1384,7 @@
        struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa;
        struct in6_multi_mship *imm;
 
-       KASSERT(!ifa_held(ifa));
+       /* KASSERT(!ifa_held(ifa)); XXX need ifa_not_held (psref_not_held) */
        KASSERT(IFNET_LOCKED(ifp));
 
        ifa->ifa_flags |= IFA_DESTROYING;
diff -r 968588cecb24 -r 9f55fe74f8e3 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Tue Jan 02 10:48:51 2018 +0000
+++ b/sys/netinet6/in6_pcb.c    Tue Jan 02 10:56:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_pcb.c,v 1.161.4.1 2018/01/02 10:20:34 snj Exp $    */
+/*     $NetBSD: in6_pcb.c,v 1.161.4.2 2018/01/02 10:56:58 snj Exp $    */
 /*     $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $        */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.161.4.1 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.161.4.2 2018/01/02 10:56:58 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -512,6 +512,7 @@
                if (ia4 == NULL) {
                        if (error == 0)
                                error = EADDRNOTAVAIL;
+                       curlwp_bindx(bound);
                        return (error);
                }
                memset(&mapped, 0, sizeof(mapped));
@@ -521,6 +522,7 @@
                ia4_release(ia4, &_psref);
                in6a = &mapped;
 #else
+               curlwp_bindx(bound);
                return EADDRNOTAVAIL;
 #endif
        } else {
diff -r 968588cecb24 -r 9f55fe74f8e3 sys/sys/lwp.h
--- a/sys/sys/lwp.h     Tue Jan 02 10:48:51 2018 +0000
+++ b/sys/sys/lwp.h     Tue Jan 02 10:56:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lwp.h,v 1.174 2017/04/21 15:10:35 christos Exp $       */
+/*     $NetBSD: lwp.h,v 1.174.4.1 2018/01/02 10:56:58 snj Exp $        */
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -542,6 +542,8 @@
 static inline void
 curlwp_bindx(int bound)
 {
+
+       KASSERT(curlwp->l_pflag & LP_BOUND);
        curlwp->l_pflag ^= bound ^ LP_BOUND;
 }
 



Home | Main Index | Thread Index | Old Index