As discussed on https://github.com/libfuse/libfuse/issues/1515, libfuse has
a very light dependency on libnuma, only using very light wrappers over
mmap, mbind, and munmap. Remove the libnuma dependency by calling those
syscalls directly.
Populate memory after mmap to avoid SIGBUS later.
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Create a simple fuse server that can be run as a systemd service.
I plan to create some more single-file fuse server examples, so most of
the boilerplate code goes in a separate file.
Also suppress COMPLEX_MACRO in checkpatch, FUSE_OPT_KEY
macros have to stay as they are and checkpatch annotations
are not correct here.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Teach mount.fuse3 how to start fuse via systemd service, if present.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
Create a mount helper program that can start a fuse server that runs as
a socket-based systemd service, and a new libfuse module to wrap all the
details of communicating between the mount helper and the containerized
fuse server.
This enables untrusted ext4 mounts via systemd service containers, which
avoids the problem of malicious filesystems compromising the integrity
of the running kernel through memory corruption.
In theory this could also be supported via inetd and clones, though the
author hasn't found one that supports AF_UNIX sockets.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
So far only supported for fuse_session_mount(), which is called
from high and low level API, but not yet supported for
fuse_open_channel(), which used for privilege drop through
mount.fuse. Main goal for the new API is support for synchronous
FUSE_INIT and I don't think that is going to work with
fuse_open_channel(). At least not with io-uring support as long
as it is started from FUSE_INIT.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
reading from /proc is not atomic. /etc/mtab specifically is only
atomic within a single read syscall, so it's possible to see
repeated or stale mounts reading it line by line. this can sometimes
cause fusermount to see the same mount hundreds or thousands of times
which results in spurious mount failures if fuse_mount_max is not set
high enough.
listmount and statmount were introduced as apis to work around the
limitations of parsing proc. fusermount now tries to use those
syscalls when available, and falls back to reading /etc/mtab if that
fails. these apis do not have libc wrappers yet.
Signed-off-by: Ben Linsay <blinsay@gmail.com>
fuse.h and fuse_lowlevel.h are already forward declaring struct statx,
there is no need for HAVE_STATX anymore. HAVE_STATX also bears the
risk to conflict with an application define. Alternatively it would
have been possible to change to HAVE_FUSE_STATX.
Get rid of the conditionals in the public header files and
also remove HAVE_STATX definition from the public
libfuse_config.h.
Edit by Bernd: Commit message and removal of HAVE_STATX from
public libfuse_config.h.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
This commit adds libfuse support for FUSE_STATX requests on
linux distributions.
Currently, statx is only supported on linux. To make the interface a
ergonomic as possible (eg using native 'struct statx' vs 'struct
fuse_statx'), this implementation gates the 'struct statx' changes
by #ifdef linux.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
This only effects example/{passthrough_hp.cc,memfs_ll.cc} and is mainly
to avoid these warnings
../example/memfs_ll.cc:1100:1: warning: missing field 'statx' initializer
[-Wmissing-designated-field-initializers]
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
FreeBSD 14 introduced a new system call, fspacectl().
Currently, it supports one operation mode, SPACECTL_DEALLOC,
which is functionally equivalent to Linux fallocate() with
FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE flags.
fspacectl() calls with SPACECTL_DEALLOC is supported on FUSE
filesystems via FUSE_FALLOCATE with the aforementioned flags.
Signed-off-by: CismonX <admin@cismon.net>
Unfortunately while cross-compiling with build tools like Buildroot it
happens to have repeated flags or anything that could lead to a warning.
This way the check fails because of a warning not related to the special
function. So let's use cc.links() and increase minimum meson_version to
0.60 since cc.links() has been added during that version.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Several meson tests were incorrectly failing
Checking for function "static_assert" : NO (cached)
Checking for function "pthread_setname_np" : NO (cached)
Check usable header "#include <linux/close_range.h>" : NO (cached)
These functions get now tested with compilation tests
and get found on my system.
Checking if "static_assert check" compiles: YES
Checking if "pthread_setname_np check" compiles: YES
Checking if "close_range check" compiles: YES
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Since pthread_setname_np() is the only pthread function that requires NPTL
and it basically only set thread name, let's check if pthread_setname_np()
does exist, otherwise let's not call pthread_setname_np() to shrink
dependencies.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
At the moment build fails due to lack of static_assert:
https://gitlab.com/jolivain/buildroot/-/jobs/9606292537
this means that the check per date is not enough, so let's use meson to
check if static_assert() is present or not and simplify
fuse_static_assert() definition by only checking HAVE_STATIC_ASSERT.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
linux/close_range.h is only available since kernel 5.9 and
https://github.com/torvalds/linux/commit/60997c3d45d9a67daf01c56d805ae4fec37e0bd8
resulting in the following build failure:
../util/fusermount.c:40:10: fatal error: linux/close_range.h: No such file or directory
So let's check for header presence and emit HAVE_LINUX_CLOSE_RANGE_H
accordingly and check for it when including <linux/close_range.h> and
calling close_range() instead of checking for close_range() function in
meson and check against HAVE_CLOSE_RANGE.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Redirect stdin/stdout/stderr to /dev/null to prevent newly opened
file descriptors from reusing these low numbers (0,1,2) and
potential issues with that.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
This is an initial implementation and quickly hacked together
within a few hours - issues expected.
This also increase to C++17 as memfs_ll makes use of more
recent features.
Background to create this was actually to be able to test large
file names (3 * 1024B), which couldn't be achieved with passthrough
file system as non of the underlying file systems seems to support
that.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
We already have some C11 pieces like Static_assert and we are likely
going to add more - tell meson to use C11.
Plain C11 does not work as there are several language extension,
like typeof - part of C23 only. We might be able to fix/workaround
such extensions with compiler ifdef, but then I prefer gnu11 over
checking which compiler is used (example gcc has __typeof vs
clangs __typeof++). And compiler extension would also defeat pedantic.
* Use single place to define the version
Defining the version in fuse_common.h, is removed, it is defined
through meson and provided by "libfuse_config.h". I.e. it avoids
to define the version twice - once in meson and once in
fuse_common.h.
Ideal would be to set integers in the meson file and create the version
string from these integers. However, meson requires that "project"
is the first meson.build keyword - with that it requires to
set the version from a string and then major/minor/hotfix integers
are created from string split.
Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
* Increase the version to 3.17.0
This is to prepare the branch for the next release.
Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
---------
Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
This enhances commit 7be56c57f9 to allow build
fuse to be built using a cross compiler
Fixes:
../meson.build:180:12: ERROR: Can not run test applications in this cross environment.
libfuse requires a 64bit off_t, it's not optional
../include/fuse_common.h:938:1: error: Kstatic assertion failed: "fuse: off_t must be 64bit"
so this only takes effect if compiling for a 32bit glibc system, it's ignored everywhere else
meson by default adds -D_FILE_OFFSET_BITS=64 to C/C++ compilers, and removes duplicate declarations
There are several opened issues in meson's git repo requesting to remove that behavior, so this makes sense even more now
this fixes compilation with muon (a C99 (mostly) meson compatible build app) in a 32bit glibc system ...
Commit d7560cc has split defines into private and public, and passed -DHAVE_LIBFUSE-PRIVATE_CONFIG_H to all C programs. But the arguments of C++ programs have not been changed. This leads to a test failure as reported in issue #734. Pass -DHAVE_LIBFUSE-PRIVATE_CONFIG_H to C++ programs too.
Fixes: #734
This addresses https://github.com/libfuse/libfuse/issues/729
commit db35a37def introduced a public
config.h (rename to fuse_config.h to avoid conflicts) that
was installed with the package and included by libfuse users
through fuse_common.h. Probablem is that this file does not have
unique defines so that they are unique to libfuse - on including
the file conflicts with libfuse users came up.
In principle all defines could be prefixed, but then most of them
are internal for libfuse compilation only. So this splits out
publically required defines to a new file 'libfuse_config.h'
and changes back to include of "fuse_config.h" only when
HAVE_LIBFUSE_PRIVATE_CONFIG_H is defined.
This also renames HAVE_LIBC_VERSIONED_SYMBOLS to
LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS, as it actually
better explains for libfuse users what that variable
is for.
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.