Commit Graph

19 Commits

Author SHA1 Message Date
Simon McVittie
5964b13f1e Constify arrays of program arguments
These are passed to non-const-correct APIs which still need a cast, but
at least we can declare the array in a way that reduces mistakes.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-08-22 15:17:13 -03:00
Sebastian Wick
3e2b76a351 revokefs: Clean up struct fuse_args with fuse_opt_free_args 2024-08-03 11:12:31 -05:00
Simon McVittie
8e63eda867 Remove Autotools build system
As discussed in #5695, I think we're reaching a point where removing
Autotools is preferable to fixing it.

1.14.x continues to use Autotools, so platforms whose Meson version is
too old can stay on that branch until it becomes unsupported. We have
a very conservative Meson dependency (Ubuntu 20.04).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Dor Askayo
f66b1ecb74 revokefs: Use glnx_opendirat_with_errno()
No change in behavior.
2023-09-22 14:32:17 +01:00
Dan Nicholson
c4738f8005 revokefs: Always bypass page cache for backend requests
By default, FUSE runs in cached I/O mode[1]. That means some I/O
responses will be taken from the page cache instead of being handled by
the FUSE process. For files opened for reading that's not a problem as
all the requests are just passed through.

However, that is problematic for files opened for writing since those
requests need to be handled by the backend. It's particularly bad for a
file opened `O_RDWR` since `read` responses from the page cache are
likely to be wrong. Instruct FUSE to use `direct-io` for those files so
that the page cache is bypassed.

1. https://docs.kernel.org/filesystems/fuse-io.html

Fixes: #5452
2023-06-28 13:26:27 +01:00
Simon McVittie
de4de4dc44 automake: Consistently include $(AM_CFLAGS) in target-specific CFLAGS
When built for i386 with Autotools, this would have detected the format
string issue fixed in #5148.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-27 09:59:43 +01:00
Simon McVittie
190bad06d2 revokefs: Remove incorrect libglnx include directory
revokefs already gets the correct include directory from the AM_CPPFLAGS.
This would also break the build with -Werror=missing-include-dirs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-27 09:59:43 +01:00
Simon McVittie
959910f933 revokefs: Use correct format string for a ssize_t
This fixes the build on ILP32 architectures such as i386 with the Meson
build system. The Autotools build system accidentally didn't build
revokefs with -Werror=format, because it sets the target-specific CFLAGS
for revokefs but does not include the $(AM_CFLAGS) in them.

Fixes: aeecbb7d "revokefs: Split out the writing part from the fuse implementation"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-25 10:32:50 +02:00
Simon McVittie
9eb824f863 Add a Meson build system
Resolves: https://github.com/flatpak/flatpak/issues/2241
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 16:12:14 +01:00
Phaedrus Leeds
600e18567c Add a vim modeline and .editorconfig
To make indentation work with less effort. The modeline was copied from
libostree with minor modification and the .editorconfig from GLib.

The advantage of having both a modeline and an editorconfig is we can
work out of the box on more editor setups, and the modeline allows us to
specify the style with a lot more fine grained control.
2022-08-22 19:48:10 -07:00
Simon McVittie
4018419b15 revokefs: Use FUSE version 3 if possible
Based on a change contributed by Léo Stefanesco; but instead of
unconditionally using FUSE 3, leave a fallback code path for FUSE 2 for
older distros.

Co-authored-by: Léo Stefanesco <leo.lveb@gmail.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-08-16 13:27:04 +02:00
Eric Curtin
c6845ad70b Fix some warn_unused_result warnings
While building on gcc 9.3.0
2021-10-12 13:50:14 -07:00
Simon McVittie
a0eaaf77ad revokefs: Use the right variable name in an error message
scan-build detected that response_size is uninitialized here, presumably
a typo for response_data_size.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-16 14:50:27 +02:00
Alexander Larsson
84e7b19683 revokefs: Fix off-by-one array size in fuse implementation
The iovec write_vecs[] array on the stack was just 2 element, but we
sometimes use 3 elements of it. This was causing random crashes due to
corrupting the stack.

Closes: #3110
Approved by: alexlarsson
2019-09-18 07:17:43 +00:00
Ryan Gonzalez
2b93928285 revokefs-fuse: Fix some build warnings
Closes: #2952
Approved by: alexlarsson
2019-06-13 07:16:33 +00:00
Umang Jain
cd53f71f9e revokefs-fuse: Add --with-exit-fd arg to monitor parent process's exit
This is necessary so as to not leave the revokefs backend around
when the system-helper exits abruptly (e.g. OOM killer). It would
be a vulnerability if revokefs backend continues to live even after
the system-helper is killed as it might lead to write access to the
underlying directory.

Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:15 +00:00
Alexander Larsson
80249b5f4d revokefs: Add demo to show how to revoke permissions
The demo starts two instances by the same users so
the revoke doesn't really enforce any separation, but
it demos how you would do it.

Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:15 +00:00
Alexander Larsson
aeecbb7d2b revokefs: Split out the writing part from the fuse implementation
By default we just spawn a writer from the fuse implementation,
but you can also do it manually with --backend and --socket,
allowing you to start the two in different contexts.

Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:14 +00:00
Alexander Larsson
4716ce8f2e revokefs: Initial non-revoking version
This is just a copy of rofiles-fuse with the write limits removed.

Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:14 +00:00