Fuse mount: make auto_unmount compatible with suid/dev mount options#762
Conversation
|
Btw, I'm a bit worried about race conditions for auto_unmount in general. After all, |
|
Yeah, I had scanned through your patches and the code and also seen the race. |
|
Thanks for the patch. I am generally not a big fan of I've just pushed a commit that explains the drawbacks in more detail: #763 |
b035cc2 to
cce9598
Compare
|
Could you also add a unit tests that checks if this works? |
|
Yes, working on it. I discovered a few minor issues when looking at the tests. You've already seen the PRs. |
|
@Nikratio I added a test. |
|
Looks like the test discovered some memory leaks. |
|
Yes, I'll check that. Perhaps it's one I just introduced, even. |
|
@Nikratio I found the memory leak and fixed it. Weirdly enough, it's in More detail: when { "source=%s",
offsetof(struct lo_data, source), 0 },in |
|
|
||
| } else { | ||
| lo.source = "/"; | ||
| lo.source = strdup("/"); |
There was a problem hiding this comment.
The true-branch of this if gives us a malloc-ed string. So for symmetry, we make this one a malloced on, too. So we can free without a care further down.
> When you run as root, fuse normally does not call fusermount but uses > the mount system call directly. When you specify auto_unmount, it goes > through fusermount instead. However, fusermount is a setuid binary that > is normally called by regular users, so it cannot in general accept suid > or dev options. In this patch, we split up how fuse mounts as root when `auto_unmount` is specified. First, we mount using system calls directly, then we reach out to fusermount to set up auto_unmount only (with no actual mounting done in fusermount). Fixes libfuse#148
50bdd1d to
d0d85c7
Compare
|
@Nikratio Does this one need more changes? |
Split test into root vs non-root, so that the output of pytest makes clear what functionality is being tested.
In this patch, we split up how fuse mounts as root when
auto_unmountis specified.First, we mount using system calls directly, then we reach out to fusermount to set up auto_unmount only (with no actual mounting done in fusermount).
Fixes #148