lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 30 May 2008 05:22:06 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	mathieu.desnoyers@...ymtl.ca, maneesh@...ux.vnet.ibm.com,
	jkennisto@...ibm.com
Subject: Question about smp_read_barrier_depends() in kernel/marker.c

Hello, Mathieu,

I am a bit confused by the smp_read_barrier_depends() in kernel/markers.c.
My (probably naive) view is that they need to move as shown in the patch
below.  Help?

Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
---

 marker.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4/kernel/marker.c linux-2.6.26-rc4-marker-srbd/kernel/marker.c
--- linux-2.6.26-rc4/kernel/marker.c	2008-05-30 04:39:01.000000000 -0700
+++ linux-2.6.26-rc4-marker-srbd/kernel/marker.c	2008-05-30 05:05:55.000000000 -0700
@@ -133,8 +133,8 @@ void marker_probe_cb(const struct marker
 		 * data. Same as rcu_dereference, but we need a full smp_rmb()
 		 * in the fast path, so put the explicit barrier here.
 		 */
-		smp_read_barrier_depends();
 		multi = mdata->multi;
+		smp_read_barrier_depends();
 		for (i = 0; multi[i].func; i++) {
 			va_start(args, fmt);
 			multi[i].func(multi[i].probe_private, call_private, fmt,
@@ -183,8 +183,8 @@ void marker_probe_cb_noarg(const struct 
 		 * data. Same as rcu_dereference, but we need a full smp_rmb()
 		 * in the fast path, so put the explicit barrier here.
 		 */
-		smp_read_barrier_depends();
 		multi = mdata->multi;
+		smp_read_barrier_depends();
 		for (i = 0; multi[i].func; i++)
 			multi[i].func(multi[i].probe_private, call_private, fmt,
 				&args);
@@ -271,6 +271,7 @@ marker_entry_add_probe(struct marker_ent
 	new[nr_probes].func = probe;
 	new[nr_probes].probe_private = probe_private;
 	entry->refcount = nr_probes + 1;
+	smp_wmb(); /* Ensure struct is initialized before publication. *
 	entry->multi = new;
 	entry->ptype = 1;
 	debug_print_probes(entry);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ