<div dir="ltr">Hi,<div><br></div><div>I think it would be fair to detect the valgrind headers presence in the Makefile and ifdef the include (else define dummy ANNOTATE_* macros).</div><div><br></div><div>Would you care to prepare that ?</div><div><br></div><div>Thanks.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 16, 2016 at 10:00 PM, Bart Van Assche <span dir="ltr"><<a href="mailto:bart.vanassche@sandisk.com" target="_blank">bart.vanassche@sandisk.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The global variable multipath_conf is modified through RCU. Hence<br>
avoid that the data race detection tools Helgrind and DRD report<br>
data races for this variable.<br>
<br>
The global variable running_state is read without holding the mutex<br>
that protects changes of this variable. Suppress complaints about<br>
these reads.<br>
<br>
The global variable uxsock_timeout is not protected by any mutex.<br>
Suppress complaints about using this variable.<br>
<br>
This patch introduces a new build-time requirement, namely that<br>
the valgrind-devel package has been installed.<br>
<br>
Signed-off-by: Bart Van Assche <<a href="mailto:bart.vanassche@sandisk.com">bart.vanassche@sandisk.com</a>><br>
---<br>
 multipathd/main.c | 8 ++++++++<br>
 1 file changed, 8 insertions(+)<br>
<br>
diff --git a/multipathd/main.c b/multipathd/main.c<br>
index 1d73b4c..54abfef 100644<br>
--- a/multipathd/main.c<br>
+++ b/multipathd/main.c<br>
@@ -23,6 +23,7 @@<br>
 #endif<br>
 #include <semaphore.h><br>
 #include <time.h><br>
+#include <valgrind/helgrind.h><br>
<br>
 /*<br>
  * libcheckers<br>
@@ -2520,6 +2521,13 @@ main (int argc, char *argv[])<br>
        int foreground = 0;<br>
        struct config *conf;<br>
<br>
+       ANNOTATE_BENIGN_RACE_SIZED(&<wbr>multipath_conf, sizeof(multipath_conf),<br>
+                                  "Manipulated through RCU");<br>
+       ANNOTATE_BENIGN_RACE_SIZED(&<wbr>running_state, sizeof(running_state),<br>
+               "Suppress complaints about unprotected running_state reads");<br>
+       ANNOTATE_BENIGN_RACE_SIZED(&<wbr>uxsock_timeout, sizeof(uxsock_timeout),<br>
+               "Suppress complaints about this scalar variable");<br>
+<br>
        logsink = 1;<br>
<br>
        if (getuid() != 0) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.2<br>
<br>
</font></span></blockquote></div><br></div>