Commit Graph

653 Commits

Author SHA1 Message Date
tenzap
6d55007027 Whitelist UFSD (backport to 2.9 branch) (#452) 2019-09-15 08:57:08 -07:00
Nikolaus Rath
d046879231 Released 2.9.9 2019-01-04 13:38:34 +00:00
Nikolaus Rath
41e3e7c00e Added OpenAFS to type whitelist
Fixes: #336.
2019-01-04 13:34:34 +00:00
Rostislav Skudnov
06fc40705f Fix readdir() bug when a non-zero offset is specified in filler
The bug occurs when a filesystem client reads a directory until the end,
seeks using seekdir() to some valid non-zero position and calls
readdir(). A valid 'struct dirent *' is expected, but NULL is returned
instead. Pseudocode demonstrating the bug:

DIR *dp = opendir("some_dir");
struct dirent *de = readdir(dp);

/* Get offset of the second entry */
long offset = telldir(dp);

/* Read directory until the end */
while (de)
	de = readdir(de);

seekdir(dp, offset);
de = readdir(dp);
/* de must contain the second entry, but NULL is returned instead */

The reason of the bug is that when the end of directory is reached, the
kernel calls FUSE_READDIR op with an offset at the end of directory, so
the filesystem's .readdir callback never calls the filler function, and
we end up with dh->filled set to 1. After seekdir(), FUSE_READDIR is
called again with a new offset, but this time the filesystem's .readdir
callback is never called, and an empty reply is returned.

Fix by setting dh->filled to 1 only when zero offsets are given to
filler function.

This commit is backported from the following commit in 'master' branch:

commit 5f125c5e6b
Author: Rostislav <rostislav@users.noreply.github.com>
Date:   Sat Jul 21 12:57:09 2018 +0300

    Fix readdir() bug when a non-zero offset is specified in filler (#269)
2018-07-25 12:28:59 +01:00
Nikolaus Rath
6172ece717 Released 2.9.8 2018-07-25 11:05:35 +01:00
Nikolaus Rath
3eb3c6995f Add changelog entry for commit b045e. 2018-07-21 12:20:49 +01:00
Nikolaus Rath
57ab9586b1 Added ChangeLog entry for hardening patches. 2018-07-21 12:19:30 +01:00
Bill Zissimopoulos
a0c14264e9 rename: perform user mode dir loop check when not done in kernel
Linux performs the dir loop check (rename(a, a/b/c)
    or rename(a/b/c, a), etc.) in kernel. Unfortunately
    other systems do not perform this check (e.g. FreeBSD).
    This results in a deadlock in get_path2, because libfuse
    did not expect to handle such cases.

    We add a check_dir_loop function that performs the dir
    loop check in user mode and enable it on systems that
    need it.
2018-06-07 10:17:12 +01:00
Nikolaus Rath
df499bf1ce Released 2.9.7. 2016-06-20 12:55:12 -07:00
Hendrik Brueckner
6189312b0c libfuse/fuse_daemonize: wait until daemon child process is ready (#55)
Mounting a FUSE file system remotely using SSH in combination with
pseudo-terminal allocation (-t), results in "Transport endpoint is
not connected" errors when trying to access the file system contents.

For example:

  # ssh -t root@localhost  "cmsfs-fuse /dev/disk/by-path/ccw-0.0.0190 /CMSFS"
  Connection to localhost closed.
  # ls /CMSFS
  ls: cannot access '/CMSFS': Transport endpoint is not connected

The cmsfs-fuse main program (which can also be any other FUSE file
system) calls into the fuse_main() libfuse library function.
The fuse_main() function later calls fuse_daemonize() to fork the
daemon process to handle the FUSE file system I/O.

The fuse_daemonize() function calls fork() as usual.  The child
proceeds with setsid() and then redirecting its file descriptors
to /dev/null etc.  The parent process, simply exits.

The child's functions and the parent's exit creates a subtle race.
This is seen with an SSH connection.  The SSH command above calls
cmsfs-fuse on an allocated pseudo-terminal device (-t option).

If the parent exits, SSH receives the command completion and closes
the connection, that means, it closes the master side of the
pseudo-terminal.  This causes a HUP signal being sent to the process
group on the pseudo-terminal.  At this point in time, the child might
not have completed the setsid() call and, hence, becomes terminated.
Note that fuse daemon sets up its signal handlers after fuse_daemonize()
has completed.

Even if the child has the chance to disassociate from its parent process
group to become it's own process group with setsid(), the child still
has the pseudo-terminal opened as stdin, stdout, and stderr.  So the
pseudo-terminal still behave as controlling terminal and might cause a
SIGHUP at closing the the master side.

To solve the problem, the parent has to wait until the child (the fuse
daemon process) has completed its processing, that means, has become
its own process group with setsid() and closed any file descriptors
pointing to the pseudo-terminal.

Closes: #27

Reported-by: Ofer Baruch <oferba@il.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
2016-06-20 12:50:05 -07:00
Dalvik Khertel
9448849b56 libfuse: pass security context options to kernel
Mount can be used with an "-o context=" option in order to specify a
mountpoint-wide SELinux security context different from the default context
provided by the active SELinux policy.

This is useful in order to enable users to mount multiple sshfs targets under
distinct contexts, which is my main motivation for getting this patch mainlined.

Closes: #36
2016-06-20 12:49:36 -07:00
Nikolaus Rath
a82a069c97 Released 2.9.6 2016-04-23 09:48:15 -07:00
Nikolaus Rath
1ac9ca5636 Released 2.9.5 2016-01-14 11:20:22 -08:00
Nikolaus Rath
7a7f10cd3f Mention new maintainer in Changelog. 2016-01-14 11:18:33 -08:00
Nikolaus Rath
e786950b1d Changed Changelog format
Up to now, the Changelog has essentially been a (manually maintained)
copy of the git commit history. This doesn't seem to have any point
other than following the GNU coding standards. I believe it's much
better to use the Changelog to summarize the release-to-release
changes that are most important for users, so this is what we'll do
from now on.
2016-01-14 11:15:00 -08:00
Miklos Szeredi
0285462226 libfuse: fix warning mount.c:receive_fd()
Reported by Albert Berger
2015-08-12 11:53:10 +02:00
Miklos Szeredi
1fbc6e5353 libfuse: fix possible memory leak
Reported by Jose R. Guzman
2015-06-29 18:08:07 +02:00
Miklos Szeredi
6adcb719a9 Released 2.9.4 2015-05-22 11:24:02 +02:00
Miklos Szeredi
0516ee45ec libfuse: fix exec environment for mount and umount
Found by Tavis Ormandy (CVE-2015-3202).
2015-05-22 11:01:12 +02:00
Miklos Szeredi
cd757d22b4 libfuse: fix fuse_remove_signal_handlers()
to properly restore the default signal handler.

Reported by: Chris Johnson <johnsocg@gmail.com>
2015-02-26 16:58:37 +01:00
Miklos Szeredi
4163109fd5 libfuse: document deadlock avoidance for fuse_notify_inval_entry()
and fuse_notify_delete()

Reported by Han-Wen Nienhuys
2014-07-22 06:36:01 +02:00
Miklos Szeredi
4e8f86d4d6 Initilaize stat buffer passed to ->getattr() and ->fgetattr()
to zero in all cases.

Reported by Daniel Iwan.
2014-07-22 06:31:23 +02:00
Miklos Szeredi
d6c284cbda libfuse: highlevel API: fix directory file handle passed to ioctl() method
Reported by Eric Biggers
2014-07-21 18:59:23 +02:00
Miklos Szeredi
60ac20d25f fusermount, libfuse: send value as unsigned in "user_id=" and "group_id="
...options.  Uids/gids larger than 2147483647 would result in EINVAL when
mounting the filesystem.  This also needs a fix in the kernel.
2014-07-21 18:59:05 +02:00
Daniel Thau
78bc1108d5 Add missing includes
This allows compiling fuse with musl.
2013-08-26 12:01:17 +02:00
Miklos Szeredi
d44bf3a4ac Released 2.9.3 2013-07-01 10:48:51 +02:00
Miklos Szeredi
ddfd2d44a6 libfuse: fix multiple close of device fd
- fuse_kern_unmount closes handle (e.g. 19)
- a thread in my process opens a file - the OS assigns newly freed
handle (i.e. 19)
- fuse_kern_chan_destroy closes the same handle (i.e. 19)
- a thread in my process opens another file - the OS assigns newly
freed handle (i.e. 19)
- * MAYHEM *

Reported by Dan Greenfield
2013-07-01 10:06:37 +02:00
Miklos Szeredi
44088bc7fb libfuse: fix thread cancel race
Exiting a worker my race with cancelling that same worker.  This caused a
segmenation fault.

Reported and tested by Anatol Pomozov
2013-03-19 17:16:14 +01:00
Anatol Pomozov
eb385fbe93 libfuse: rename ./configure.in to ./configure.ac
Next version of automake (1.14) removes support for the deprecated filename

http://lists.gnu.org/archive/html/autotools-announce/2013-01/msg00000.html
2013-02-04 18:30:15 +01:00
Anatol Pomozov
839550d319 libfuse: Use AC_CONFIG_HEADERS instead of AM_CONFIG_HEADER
AM_CONFIG_HEADER has been deprecated for years and autotools 1.13
removes this macros at all.
2013-02-04 18:30:15 +01:00
Miklos Szeredi
f80f367815 libfuse: configure: detect new util-linux
Apparently new versions of util-linux umount return with an exit status of 1
even if the "--fake" option is recognised (despite being documented otherwise).
Check this condition and don't complain about util-linux version.
2013-02-04 18:30:14 +01:00
Madan Valluri
d7bf78d913 libfuse: fix the 'remember' option
The lru list was not initialized for the "/" path.  This resulted in
remove_node_lru() crashing on LOOKUP-DOTDOT.

Patch by Madan Valluri.
--
 ChangeLog  |    4 ++++
 lib/fuse.c |    4 ++++
 2 files changed, 8 insertions(+)
2013-02-04 18:30:14 +01:00
Ratna_Bolla@dell.com
3a2bd4da6b libfuse: fix crash in unlock_path()
Patch by Ratna Manoj.

queue_element_unlock() should set ->first_locked and ->second_locked to false.

Discovered with 'fs_racer'.  The assert(wnode->treelock == TREELOCK_WRITE) in
unlock_path() was hit within minutes.

Miklos: simplified patch
2013-02-04 18:30:14 +01:00
Miklos Szeredi
ad38195a88 Released 2.9.2 2012-10-01 19:56:49 +02:00
Miklos Szeredi
66956b6f7a Fix deadlock in libfuse
Running "svn update" on a fuse filesystem could deadlock because of a bug in the
way the paths are locked.

Reported by Kazuaki Anami
2012-10-01 17:55:55 +02:00
Miklos Szeredi
5568aa7cd5 Fix missing config.h in buffer.c
Due to an oversight, splice will never actually be used for i/o.  Someone forgot
to #include "config.h" in lib/buffer.c (in fact almost no files include that
header).  As a result, even though configure detects splice support and puts
HAVE_SPLICE in config.h, buffer.c is always compiled as if there is no splice
support.

Also add #include "config.h" to fuse.c and fuse_lowlevel.c.  These currently
include it indirectly through fuse_misc.h, but we don't want to depend on that.

Reported by Matthew Gabeler-Lee
2012-08-24 15:18:19 +02:00
Miklos Szeredi
1061a0a2d9 Fix "fuse internal error: node NNN not found"
Commit 4dc7e675bb (Don't unhash name in FORGET) broke the forget logic in a
subtle way, resulting in "fuse internal error: node NNN not found" and causing
the filesystem daemon to abort.

Fix by incrementing the node refcount if nlookup goes from zero to one.

Reported by Kyle Lippincott
2012-08-14 11:18:07 +02:00
Natanael Copa
efeac22bfa Fix linking against GNU libiconv
Use quotation marks when assigning shell variable.

This broke by 384496dd02, most likely by mistake.
2012-08-13 12:51:17 +02:00
Miklos Szeredi
1186ccaa8d Released 2.9.1 2012-07-19 15:22:38 +02:00
Miklos Szeredi
3c4c063a2f Fix crash caused by freeing a stack address
The failure path of try_get_path2() erronously tried to free the "path1" value
(an address on the stack) instead of the allocated string pointed to by "path1".
This caused the library to crash.

Reported by Itay Perl
2012-07-19 15:05:56 +02:00
Miklos Szeredi
86439d5ab6 Add fallocate to NEWS 2012-07-19 15:02:02 +02:00
Olivier Blin
a6a8bcbeef Fix build with automake >= 1.12.1
mkdir_p is deprecated since automake 1.12.1 (see automake commit
7a1eb9ff9027929687f12905e131f6fda3fa6d0c).

MKDIR_P should be used instead of mkdir_p.
This is available since autoconf 2.59d (2006-06-05), by calling
AC_PROG_MKDIR_P.

The mkdir_p workaround was not working anyway for out-of-tree builds,
since the ../mkinstalldirs path would be incorrect.
2012-07-04 12:19:29 +02:00
Olivier Blin
fd4a816823 Fix install from out-of-tree build
When building out-of-tree, install fails since it tries to copy
mount.fuse binary from source directory.

Patch initially from Damien Thébault (SoftAtHome)
2012-07-04 12:19:29 +02:00
Anatol Pomozov
96ac0e5d76 Add FALLOCATE operation
fallocate filesystem operation preallocates media space for the given file.
If fallocate returns success then any subsequent write to the given range
never fails with 'not enough space' error.
2012-06-18 13:32:43 +02:00
Miklos Szeredi
46b9c3326d Fix the compile command in the examples
Reported by Luciano Dalle Ore
2012-05-16 17:31:33 +02:00
Miklos Szeredi
384496dd02 Fix -pthread in fuse.pc
Linking to a library that uses threads requires the application to be linked
with -pthreads otherwise some pthread functions will be linked to stubs in
glibc.  So move -pthread from Libs.private to Libs in fuse.pc.

Reported by Werner Fink
2012-05-16 16:45:27 +02:00
Miklos Szeredi
acc5c79dd6 Released 2.9.0 2012-04-20 16:30:05 +02:00
Miklos Szeredi
2eac08be52 Add missing fuse_fs_flock to fuse_versionscript 2012-04-20 14:17:39 +02:00
Miklos Szeredi
71bfb92607 Add 'flag_utime_omit_ok' flag to fuse_operations
If the filesystem sets this flag then ->utimens() will receive UTIME_OMIT and
UTIME_NOW values as specified in utimensat(2).
2012-04-10 16:37:03 +02:00
Miklos Szeredi
6f77e7de6f Check protocol version before sending notifications
Check protocol version before sending notifications and return -ENOSYS if a
particular notification is not supported.
2012-04-10 16:01:00 +02:00