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/b73afad6bea4
branches:  netbsd-8
changeset: 434566:b73afad6bea4
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 16 13:04:33 2018 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #498):
        sys/kern/uipc_domain.c: revision 1.101
        sys/sys/domain.h: revision 1.34
        sys/rump/librump/rumpnet/rump_net.c: revision 1.21
Don't start callouts for domains before attaching domains on rump kernels
On rump kernels, the callouts for domains, pffasttimo and pfslowtimo, started
before domains were attached. Normally the callouts were dispatched after
domain attaches (initializations) finished, however, under load the callouts
could be executed prior to the attaches, resulting in that the callouts accessed
unallocated or uninitialized resources.

diffstat:

 sys/kern/uipc_domain.c              |  30 ++++++++++++++++++++++++------
 sys/rump/librump/rumpnet/rump_net.c |   6 ++++--
 sys/sys/domain.h                    |   3 ++-
 3 files changed, 30 insertions(+), 9 deletions(-)

diffs (103 lines):

diff -r eec94f61f720 -r b73afad6bea4 sys/kern/uipc_domain.c
--- a/sys/kern/uipc_domain.c    Tue Jan 16 13:01:10 2018 +0000
+++ b/sys/kern/uipc_domain.c    Tue Jan 16 13:04:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_domain.c,v 1.96.10.1 2017/07/25 01:55:21 snj Exp $        */
+/*     $NetBSD: uipc_domain.c,v 1.96.10.2 2018/01/16 13:04:33 martin Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.96.10.1 2017/07/25 01:55:21 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.96.10.2 2018/01/16 13:04:33 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -84,6 +84,17 @@
 static struct domain domain_dummy;
 __link_set_add_rodata(domains,domain_dummy);
 
+static void
+domain_init_timers(void)
+{
+
+       callout_init(&pffasttimo_ch, CALLOUT_MPSAFE);
+       callout_init(&pfslowtimo_ch, CALLOUT_MPSAFE);
+
+       callout_reset(&pffasttimo_ch, 1, pffasttimo, NULL);
+       callout_reset(&pfslowtimo_ch, 1, pfslowtimo, NULL);
+}
+
 void
 domaininit(bool attach)
 {
@@ -108,13 +119,20 @@
                }
                if (rt_domain)
                        domain_attach(rt_domain);
+
+               domain_init_timers();
        }
+}
 
-       callout_init(&pffasttimo_ch, CALLOUT_MPSAFE);
-       callout_init(&pfslowtimo_ch, CALLOUT_MPSAFE);
+/*
+ * Must be called only if domaininit has been called with false and
+ * after all domains have been attached.
+ */
+void
+domaininit_post(void)
+{
 
-       callout_reset(&pffasttimo_ch, 1, pffasttimo, NULL);
-       callout_reset(&pfslowtimo_ch, 1, pfslowtimo, NULL);
+       domain_init_timers();
 }
 
 void
diff -r eec94f61f720 -r b73afad6bea4 sys/rump/librump/rumpnet/rump_net.c
--- a/sys/rump/librump/rumpnet/rump_net.c       Tue Jan 16 13:01:10 2018 +0000
+++ b/sys/rump/librump/rumpnet/rump_net.c       Tue Jan 16 13:04:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $   */
+/*     $NetBSD: rump_net.c,v 1.20.6.1 2018/01/16 13:04:34 martin Exp $ */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.20.6.1 2018/01/16 13:04:34 martin Exp $");
 
 #include <sys/param.h>
 
@@ -56,4 +56,6 @@
        rump_component_init(RUMP_COMPONENT_NET_ROUTE);
        rump_component_init(RUMP_COMPONENT_NET_IF);
        rump_component_init(RUMP_COMPONENT_NET_IFCFG);
+
+       domaininit_post();
 }
diff -r eec94f61f720 -r b73afad6bea4 sys/sys/domain.h
--- a/sys/sys/domain.h  Tue Jan 16 13:01:10 2018 +0000
+++ b/sys/sys/domain.h  Tue Jan 16 13:04:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: domain.h,v 1.32.10.1 2017/10/24 08:55:56 snj Exp $     */
+/*     $NetBSD: domain.h,v 1.32.10.2 2018/01/16 13:04:34 martin Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -103,6 +103,7 @@
 extern struct domainhead domains;
 void domain_attach(struct domain *);
 void domaininit(bool);
+void domaininit_post(void);
 #endif
 
 #endif /* !_SYS_DOMAIN_H_ */



Home | Main Index | Thread Index | Old Index