Hello,

I'm trying to run valgrind on my FUSE filesystem, and I'm running into
a similar problem as this thread:

http://sourceforge.net/mailarchive/message.php?msg_id=26871509

I've hit a deadlock waiting for chdir(), close(), fchdir(), and
stat64() (found by running valgrind with --trace-syscalls=yes). The
patch below makes valgrind work for my application. I'm not too
familiar with valgrind internals - is there a reason for assuming that
syscalls won't block by default? Are there any other side-effects for
a patch like this?

Thanks,
-Mike

Index: coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- coregrind/m_syswrap/syswrap-generic.c       (revision 11899)
+++ coregrind/m_syswrap/syswrap-generic.c       (working copy)
@@ -2848,6 +2848,7 @@

 PRE(sys_chdir)
 {
+   *flags |= SfMayBlock;
   PRINT("sys_chdir ( %#lx(%s) )", ARG1,(char*)ARG1);
   PRE_REG_READ1(long, "chdir", const char *, path);
   PRE_MEM_RASCIIZ( "chdir(path)", ARG1 );
@@ -2878,6 +2879,7 @@

 PRE(sys_close)
 {
+   *flags |= SfMayBlock;
   PRINT("sys_close ( %ld )", ARG1);
   PRE_REG_READ1(long, "close", unsigned int, fd);

@@ -2929,6 +2931,7 @@

 PRE(sys_fchdir)
 {
+   *flags |= SfMayBlock;
   PRINT("sys_fchdir ( %ld )", ARG1);
   PRE_REG_READ1(long, "fchdir", unsigned int, fd);
 }
Index: coregrind/m_syswrap/syswrap-x86-linux.c
===================================================================
--- coregrind/m_syswrap/syswrap-x86-linux.c     (revision 11899)
+++ coregrind/m_syswrap/syswrap-x86-linux.c     (working copy)
@@ -1404,6 +1404,7 @@

 PRE(sys_stat64)
 {
+   *flags |= SfMayBlock;
   PRINT("sys_stat64 ( %#lx(%s), %#lx )",ARG1,(char*)ARG1,ARG2);
   PRE_REG_READ2(long, "stat64", char *, file_name, struct stat64 *, buf);
   PRE_MEM_RASCIIZ( "stat64(file_name)", ARG1 );

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to