multipathd: Suppress uninteresting data race reports
PATCH 1/1 multipathd: Suppress uninteresting data race reports
The global variable multipath_conf is modified through RCU. Hence avoid that the data race detection tools Helgrind and DRD report data races for this variable.
The global variable running_state is read without holding the mutex that protects changes of this variable. Suppress complaints about these reads.
The global variable uxsock_timeout is not protected by any mutex. Suppress complaints about using this variable.
This patch introduces a new build-time requirement, namely that the valgrind-devel package has been installed.
--- multipathd/main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
multipathd/main.c +8 -0
@@ -23,6 +23,7 @@#endif #include <semaphore.h> #include <time.h> +#include <valgrind/helgrind.h> /* * libcheckers
@@ -2520,6 +2521,13 @@ main (int argc, char *argv[])int foreground =0 ;struct config *conf; +ANNOTATE_BENIGN_RACE_SIZED (&multipath_conf,sizeof (multipath_conf), +"Manipulated through RCU" ); +ANNOTATE_BENIGN_RACE_SIZED (&running_state,sizeof (running_state), +"Suppress complaints about unprotected running_state reads" ); +ANNOTATE_BENIGN_RACE_SIZED (&uxsock_timeout,sizeof (uxsock_timeout), +"Suppress complaints about this scalar variable" ); + logsink =1 ;if (getuid () !=0 ) {
Signature · 1 line
2.9.2
Hi,
I think it would be fair to detect the valgrind headers presence in the Makefile and ifdef the include (else define dummy ANNOTATE_* macros).
Would you care to prepare that ?
Thanks.
Quoted 52 lines · Bart Van Assche
The global variable
multipath_confis modified through RCU. Hence avoid that the data race detection tools Helgrind and DRD report data races for this variable.The global variable
running_stateis read without holding the mutex that protects changes of this variable. Suppress complaints about these reads.The global variable
uxsock_timeoutis not protected by any mutex. Suppress complaints about using this variable.This patch introduces a new build-time requirement, namely that the valgrind-devel package has been installed.
Signed-off-by Bart Van Assche <[email protected]>--- multipathd/main.c | 8 ++++++++ 1 file changed, 8 insertions(+)multipathd/main.c +8
-0@@ -23,6 +23,7 @@#endif #include <semaphore.h> #include <time.h> +#include <valgrind/helgrind.h> /* * libcheckers @@ -2520,6 +2521,13 @@ main (int argc, char *argv[])int foreground =0 ;struct config *conf; +ANNOTATE_BENIGN_RACE_SIZED (&multipath_conf,sizeof (multipath_conf), +"Manipulated through RCU" ); +ANNOTATE_BENIGN_RACE_SIZED (&running_state,sizeof (running_state), +"Suppress complaints about unprotected running_state reads"); +ANNOTATE_BENIGN_RACE_SIZED (&uxsock_timeout,sizeof (uxsock_timeout), +"Suppress complaints about this scalar variable" ); +logsink = 1; if (getuid() != 0) {--
2.9.2
Quoted 4 lines · Christophe Varoqui
I think it would be fair to detect the valgrind headers presence in the
Makefileand ifdef the include (else define dummy ANNOTATE_* macros).Would you care to prepare that ?
Hello Christophe,
How about adding a copy of the valgrind.h and helgrind.h header files to the multipath-tools source tree? This is the approach that is followed by several other projects, e.g. chromium. See also https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h.
Thanks,
Bart.
I would merge that too, sure.
On Mon, Aug 29, 2016 at 5:51 PM, Bart Van Assche <[email protected]
Quoted 22 lines
wrote:
Quoted 5 lines · Christophe Varoqui
I think it would be fair to detect the valgrind headers presence in the
Makefileand ifdef the include (else define dummy ANNOTATE_* macros).Would you care to prepare that ?
Hello Christophe,
How about adding a copy of the
valgrind.handhelgrind.hheader files to the multipath-tools source tree? This is the approach that is followed by several other projects, e.g. chromium. See also
https://chromium.googlesource.com/chromium/src/base/+/master
/third_party/valgrind/valgrind.h.Thanks,
Bart.