Chris Clayton via fuse-devel
2017-07-10 10:02:35 UTC
Hi.
I've built and installed the recent fuse-3.1.0 and sshfs-3.0.0 packages. When I run:
sshfs <user>@<remote-host>:<remote-dir> <mountpoint>
the command fails with a segfault in realloc() in glibc.
Using gdb, I found that when the segfault occurs there are over 32,000 stack frames for fuse_new_30. I confirmed this by
adding a static local variable to add_opt_common() (which calls realloc()) and incrementing it each time the function is
called. At the time of the segfault its value was 65489.
I'm no expert, but I think this is due to the line 'FUSE_SYMVER(".symver fuse_new,fuse_new@@FUSE_3.1");' which
immediately precedes the definition of fuse_new_30() in lib/fuse.c. I think that makes the call to fuse_new() within
fuse_new_30() a recursive call to fuse_new_30(). I've avoided it with this patch:
--- fuse-3.1.0/lib/fuse.c.orig 2017-07-10 10:01:35.359854560 +0100
+++ fuse-3.1.0/lib/fuse.c 2017-07-10 10:01:54.739854165 +0100
@@ -4629,7 +4629,7 @@ void fuse_stop_cleanup_thread(struct fus
/* Emulates 3.0-style fuse_new(), which processes
--help */
FUSE_SYMVER(".symver fuse_new_30,***@FUSE_3.0");
-FUSE_SYMVER(".symver fuse_new,fuse_new@@FUSE_3.1");
+FUSE_SYMVER(".symver fuse_new_31,***@FUSE_3.1");
struct fuse *fuse_new_30(struct fuse_args *args,
const struct fuse_operations *op,
size_t op_size, void *user_data)
Whether it's a correct patch, I'll leave to you experts, but with it applied, the segfault goes away and the mount succeeds.
Hope this helps and thanks for your work on fuse.
Chris
I've built and installed the recent fuse-3.1.0 and sshfs-3.0.0 packages. When I run:
sshfs <user>@<remote-host>:<remote-dir> <mountpoint>
the command fails with a segfault in realloc() in glibc.
Using gdb, I found that when the segfault occurs there are over 32,000 stack frames for fuse_new_30. I confirmed this by
adding a static local variable to add_opt_common() (which calls realloc()) and incrementing it each time the function is
called. At the time of the segfault its value was 65489.
I'm no expert, but I think this is due to the line 'FUSE_SYMVER(".symver fuse_new,fuse_new@@FUSE_3.1");' which
immediately precedes the definition of fuse_new_30() in lib/fuse.c. I think that makes the call to fuse_new() within
fuse_new_30() a recursive call to fuse_new_30(). I've avoided it with this patch:
--- fuse-3.1.0/lib/fuse.c.orig 2017-07-10 10:01:35.359854560 +0100
+++ fuse-3.1.0/lib/fuse.c 2017-07-10 10:01:54.739854165 +0100
@@ -4629,7 +4629,7 @@ void fuse_stop_cleanup_thread(struct fus
/* Emulates 3.0-style fuse_new(), which processes
--help */
FUSE_SYMVER(".symver fuse_new_30,***@FUSE_3.0");
-FUSE_SYMVER(".symver fuse_new,fuse_new@@FUSE_3.1");
+FUSE_SYMVER(".symver fuse_new_31,***@FUSE_3.1");
struct fuse *fuse_new_30(struct fuse_args *args,
const struct fuse_operations *op,
size_t op_size, void *user_data)
Whether it's a correct patch, I'll leave to you experts, but with it applied, the segfault goes away and the mount succeeds.
Hope this helps and thanks for your work on fuse.
Chris