aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mount_util.c
AgeCommit message (Collapse)AuthorLines
2024-10-11ignore mtab on androidDaniel Rosenberg-1/+1
Updating the mtab on Android fails due to differences in toybox's mount command. Setting IGNORE_MTAB avoids that issue. Signed-off-by: Daniel Rosenberg <drosen@google.com>
2024-06-25Add nullptr check in fuse_session_mountBernd Schubert-0/+5
The pointer did not have any sanity check. Addresses https://github.com/libfuse/libfuse/issues/979
2024-02-24Passthrough options starting with "x-" to mtab (#894)Matthew-4/+0
This implements #651, tested with bindfs. "x-*" options are comments meant to be interpreted by userspace. #651 is about some 3rd party mount options like 'x-gvfs-notrash'. This also removes the test if /etc/mtab is a symlink. This test was added in commit 5f28cd15ab43c741f6d116be4d3a9aa5d82ab385 and the corresponding ChangeLog entry in this commit points to mount issues for read-only mtab. However, in all recent Linux distributions /etc/mtab is a symlink to /proc/self/mounts and never writable. In fact, util-linux 2.39 (libmount) entirely removed support for a writable mtab. At least since util-linux 2.19 (10-Feb-2011) /run/mount/utab is used as replacement for userspace mount entries..
2023-04-06Fix MS_LAZYTIME not defined on uclibc and move all MS_* and UMOUNT_* (#753)Giulio Benetti-1/+4
as well as <sys/mount.h> inclusion to new fuse_mount_compat.h file. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2023-01-28Install a the configure_file (config.h) and use in headersBernd Schubert-1/+1
This addresses: https://github.com/libfuse/libfuse/issues/724 HAVE_LIBC_VERSIONED_SYMBOLS configures the library if to use versioned symbols and is set at meson configuration time. External filesystems (the main target, actually) include fuse headers and the preprocessor then acts on HAVE_LIBC_VERSIONED_SYMBOLS. Problem was now that 'config.h' was not distributed with libfuse and so HAVE_LIBC_VERSIONED_SYMBOLS was never defined with external tools and the preprocessor did the wrong decision. This commit also increases the the minimal meson version, as this depends on meson feature only available in 0.50 <quote 'meson' > WARNING: Project specifies a minimum meson_ version '>= 0.42' but uses features which were added in newer versions: * 0.50.0: {'install arg in configure_file'} </quote> Additionally the config file has been renamed to "fuse_config.h" to avoid clashes - 'config.h' is not very specific.
2021-01-17Fix FTBFS on kfreebsd (#581)Laurent Bigonville-1/+1
kfreebsd is a FreeBSD kernel and a GNU libc The only macro defined in that case is __FreeBSD_kernel__ Fix #580
2019-01-14Add support for buildin under DragonFly BSDTomohiro Kusumi-3/+3
70e25ea74e("Fix build on non-Linux") broke build on DragonFly BSD, or likely anything other than FreeBSD and NetBSD that is not Linux. Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
2018-11-11Fix build on non-LinuxRoman Bogorodskiy-2/+4
* Update meson.build to add mount_util.c to libfuse_sources unconditionally, it's non Linux-only * FreeBSD, like NetBSD, doesn't have mntent.h, so don't include that and define IGNORE_MTAB for both * FreeBSD, like NetBSD, has no umount2() sysctl, so similarly define it to unmount()
2018-10-09Allow passing `/dev/fuse` file descriptor from parent processMattias Nissler-0/+13
This adds support for a mode of operation in which a privileged parent process opens `/dev/fuse` and takes care of mounting. The FUSE file system daemon can then run as an unprivileged child that merely processes requests on the FUSE file descriptor, which get passed using the special `/dev/fd/%u` syntax for the mountpoint parameter. The main benefit is that no privileged operations need to be performed by the FUSE file system daemon itself directly or indirectly, so the FUSE process can run with fully unprivileged and mechanisms like securebits and no_new_privs can be used to prevent subprocesses from re-acquiring privilege via setuid, fscaps, etc. This reduces risk in case the FUSE file system gets exploited by malicious file system data. Below is an example that illustrates this. Note that I'm using shell for presentation purposes, the expectation is that the parent process will implement the equivalent of the `mount -i` and `capsh` commands. ``` \# example/hello can mount successfully with privilege $ sudo sh -c "LD_LIBRARY_PATH=build/lib ./example/hello /mnt/tmp" $ sudo cat /mnt/tmp/hello Hello World! $ sudo umount /mnt/tmp \# example/hello fails to mount without privilege $ sudo capsh --drop=all --secbits=0x2f -- -c 'LD_LIBRARY_PATH=build/lib ./example/hello -f /mnt/tmp' fusermount3: mount failed: Operation not permitted \# Passing FUSE file descriptor via /dev/fd/%u allows example/hello to work without privilege $ sudo sh -c ' exec 17<>/dev/fuse mount -i -o nodev,nosuid,noexec,fd=17,rootmode=40000,user_id=0,group_id=0 -t fuse hello /mnt/tmp capsh --drop=all --secbits=0x2f -- -c "LD_LIBRARY_PATH=build/lib example/hello /dev/fd/17" ' $ sudo cat /mnt/tmp/hello Hello World! $ sudo umount /mnt/tmp ```
2016-12-23Set IGNORE_MTAB when running under NetBSDNikolaus Rath-1/+4
Apparently, NetBSD does not have /etc/mtab. Setting IGNORE_MTAB in this case makes the code a little nicer. See also https://github.com/libfuse/libfuse/pull/123
2016-10-15Removed -o nonempty optionNikolaus Rath-33/+0
This brings the default behavior in-line with that of the regular `mount` command.
2016-10-02Extended per-file comments.Nikolaus Rath-0/+2
This should make more clear what file contains code for what purpose.
2016-07-21add error checking to setuid calls (#66)Alex Richman-3/+21
2015-05-22libfuse: fix exec environment for mount and umountMiklos Szeredi-6/+17
Found by Tavis Ormandy (CVE-2015-3202).
2013-08-26Merge remote-tracking branch 'origin/fuse_2_9_bugfix'Miklos Szeredi-0/+1
2013-08-26Add missing includesDaniel Thau-0/+1
This allows compiling fuse with musl.
2013-07-24libfuse: remove "-D_FILE_OFFSET_BITS=64" from fuse.pcMiklos Szeredi-0/+1
add AC_SYS_LARGEFILE to your configure.ac instead.
2011-05-19Don't hide output of /bin/mountMiklos Szeredi-10/+0
2011-03-30Check the return value after an open syscallLaszlo Papp-2/+4
2011-01-31fusermount: only allow mount and umount if util-linux suppports ↵Miklos Szeredi-71/+1
--no-canonicalize Remove "legacy" util-linux support as missing --no-canonicalize cannot be worked around in fuse.
2010-11-08update umount procedureMiklos Szeredi-0/+49
If umount(8) supports --fake and --no-canonicalize (util-linux-ng version 2.18 or later), and umount(2) supports the UMOUNT_NOFOLLOW flag (linux kernel version 2.6.35 or later) then, "fusermount -u" will call the umount(2) system call and use "umount --fake ..." to update /etc/mtab Added --disable-legacy-umount option to configure. This disables the runtime checking of umount(8) version. When built with this option then "fusermount -u" will fail if umount(8) doesn't support the --fake and --no-canonicalize options.
2010-11-08Open /dev/null for writeMiklos Szeredi-1/+1
Open /dev/null for write instead of read for redirecting stdout and stderr
2010-11-08Fix check for read-only fs in mtab updateMiklos Szeredi-1/+12
2010-08-27Add NetBSD supportMiklos Szeredi-0/+8
The bulk of it is just about adding ifdef __NetBSD__ where there is already an ifdef __FreeBSD__ Add a arch=netbsd to deal with NetBSD specifics. I suggests that arch=bsd could be renamed to arch=freebsd NetBSD specific linking with -lperfuse NetBSD patches to lib/mount.c. It turned to be less itrusive to patch mount;c than mount_bsd.c. I suggest mount_bsd.c could be renamed to mount_freebsd.c Patch from Emmanuel Dreyfus
2010-02-01* Released 2.8.3Miklos Szeredi-23/+2
* Using --no-canonicalize with umount(8) conflicts with the race fix, sinceit assumes the supplied path is absolute, while the race fix relies on the path being relative to the current directory
2010-01-26* Fix race if two "fusermount -u" instances are run in parallel.Miklos Szeredi-14/+17
Reported by Dan Rosenberg * Make sure that the path to be unmounted doesn't refer to a symlink
2009-12-23* Use '--no-canonicalize' option of mount(8) (available inMiklos Szeredi-14/+107
util-linux-ng version 2.17 or greater) to avoid calling readling(2) on the newly mounted filesystem before the mount procedure is finished. This has caused a deadlock if audit was enabled in the kernel. Also use '--no-canonicalize' for umount to avoid touching the mounted filesystem.
2008-07-10Skip calling mount(8) if /etc/mtab doesn't exist...Miklos Szeredi-2/+20
2008-06-10Fix missing <sys/param.h> include for PATH_MAXMiklos Szeredi-0/+1
2008-02-08Block SIGCHLD when executing mount and umountMiklos Szeredi-12/+36
2007-12-12change indentingMiklos Szeredi-197/+200
2007-11-12'fusermount -u' did not umount the filesystem if /etc/mtab was a symlinkMiklos Szeredi-2/+8
2007-10-16Clarify licence version to be "LGPLv2" for the libraryMiklos Szeredi-1/+1
2007-08-08fixesMiklos Szeredi-5/+10
2007-07-25Don't call /bin/[u]mount if /etc/mtab is a symlinkMiklos Szeredi-0/+17
2007-06-20Add fs subtype support to libfuse and fusermountMiklos Szeredi-0/+17
2007-05-03fixMiklos Szeredi-5/+0
2007-04-27libfuse: call umount(8) directly...Miklos Szeredi-0/+29
2007-04-25update copyright datesMiklos Szeredi-1/+1
2007-04-25*** empty log message ***Miklos Szeredi-0/+171