Kendy,
Yes, it is a bit problematic to use Valgrind with a Fuse file system.
Below is a short memo I wrote when I was asked to describe how to use
Valgrind with my Fuse-based FS. Hopefully it helps you too.
cheers-
patrick
Debugging with Valgrind
Problem
By default, Fuse and Valgrind do not play nice together, making
debugging memory errors in the <myfs> a bit of a hassle.
See the links below for a little bit of background.
>From
http://thread.gmane.org/gmane.comp.file-systems.fuse.devel/4095/focus=4114(note, Miklos is the developer of Fuse).
>> [*] I had been having problems with valgrind and permission problems.
>> What works is to run valgrind as root, and chmod 755
>> /usr/bin/fusermount.
>
>Yes, stupid valgrind. My workaround is to replace /usr/bin/fusermount
>with a shell script which just execs /usr/bin/fusermount.real.
>Miklos
Also, from
http://osdir.com/ml/file-systems.fuse.devel/2006-01/msg00093.html,
it appears the problem is related to setuid programs. The Fuse mount
utility, fusermount, is a setuid program.
Finally, a link in the previous message
http://bugs.kde.org/show_bug.cgi?id=119404 further explains that
setuid programs can be run by valgrind, but they cannot be traced.
Solution
Here is one possible workaround the problem.
As root,
$ cd /usr/bin
$ if [[ -e fusermount ]]; then mv fusermount fusermount.real; fi
$ touch fusermount
$ chown root.fuse fusermount
$ chmod ug+x fusermount
$ echo '#!/bin/sh' >> fusermount
$ echo 'exec /usr/bin/fusermount.real $@' >> fusermount
or depending on the path of fusermount
$ echo 'exec /bin/fusermount $@' >> fusermount
The other key point is to ensure that the setuid fusermount is not
traced. Thus valgrind should be called as
$ valgrind --tool=memcheck --trace-children=no ... myprog ...
One set of valgrind options that may be useful is
$ valgrind --tool=memcheck --trace-children=no --leak-check=full
--show-reachable=yes --max-stackframe=3000000 -v ./myfs ...
On 10/9/07, Kendy Kutzner <
kutzner@...> wrote:
> Hello List,
>
> I want to debug my file system and want to use valgrind or similar
> tools to do that. However, that bails out with the error message
> "fuse: failed to exec fusermount: Permission denied"
> Ok, calling setuid-binaries from traced programs is problematic.
>
> However, 'sudo valgrind ./my_file_system' gives the same error
> message. Same for a real root shell with su -
>
> Any hints on how to use valgrind like programs with fuse file systems?
>
> Kendy
>
> --
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>
http://get.splunk.com/> _______________________________________________
> fuse-devel mailing list
>
fuse-devel@...
>
https://lists.sourceforge.net/lists/listinfo/fuse-devel>
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
http://get.splunk.com/_______________________________________________
fuse-devel mailing list
fuse-devel@...
https://lists.sourceforge.net/lists/listinfo/fuse-devel