| Commit message (Collapse) | Author | Age | Files | Lines |
| |\ |
|
| | |
| |
| |
| | |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This is unnecessary for classic mount-like tasks, but application
may use libmount in situation when the default for probing is not
optimal.
Addresses: https://github.com/util-linux/util-linux/issues/2214
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* enter original namespace for the final move_mount(), it means that
the original unshare() (to create the temporary mount) will be
ineffective for this final step. God bless FD based APIs (setns()
and open_tree())! ;-)
* improve cleanup code (call umount only once)
* remember private namespace
* update note in man page
Addresses: https://github.com/util-linux/util-linux/pull/2198
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| | |
| |
| |
| |
| | |
Addresses: https://github.com/util-linux/util-linux/pull/2197
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| | |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |/
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases, for example:
# mount -t foo,bar,ext4 /dev/sdc /mnt/test
libmount calls fsopen() later (after mount preparation stage), but we
need during preparation check if hook_mount.c stuff (new API) is usable.
Let's do it by dummy fsopen() call.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
X-mount.idmap accepts a series of whitespace-separated tokens. We reject
an empty argument but silently accept an argument consisting of whitespace
with no tokens. Test for the empty case more thoroughly.
[kzak@redhat.com: - use skip_blank()]
Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
| |
Addresses: https://github.com/util-linux/util-linux/pull/2188
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
fix_optstr() in context_mount.c calls the MNT_STAGE_PREP_OPTIONS hooks
but discards returned errors. This suppresses error messages and can
make invalid option strings 'fail open' in surprising ways. Handle error
returns from these hooks correctly.
No other callers of mnt_context_call_hooks() discard the return value,
so other hooks aren't affected.
Signed-off-by: Chris Webb <chris@arachsys.com>
|
| |
|
|
|
|
|
| |
Let's keep the file included only when the new kernel API is
necessary.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |\
| |
| |
| |
| | |
* 'libmount/relative' of https://github.com/t-8ch/util-linux:
libmount: safe_stat: support relative filenames
|
| | |
| |
| |
| |
| |
| |
| | |
By using AT_CWFD the call to statx() can also handle relative filenames.
Without this safe_stat() which is called on the fstab, source, target...
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| | |
| |
| |
| |
| |
| | |
Don't cleanup if all related to the hooks is already empty.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |/
|
|
|
| |
Fixes: https://github.com/util-linux/util-linux/issues/2182
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* don't use STATX_MODE as we need only file type
* use fstatat() or stat() as fallback on EOPNOTSUPP
* use st_rdev from statx() too
* rename to mnt_stat_mountpoint() to more generic mnt_safe_stat()
* use mnt_is_path() on more places
* cleanup mnt_context_*_excode() to not use stat()
* use on others places mnt_safe_stat()
Note that on some places stat() remaining, but it's not related to the
mountpoints, it's about /run/mount/utab permissions, file locking and
/dev/* permissions for non-root mounts.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* prefer statx() with AT_STATX_DONT_SYNC if available
* keep fstatat() and stat() as fallback
* add test to mnt_stat_mountpoint()
The goal is to minimize situations when we need classic stat() because
it triggers automount, and stat() syscall may hang on unreachable
network filesystems. The automount issue was resolved years ago by
AT_NO_AUTOMOUNT; now we can use statx() to fix also hangs on NFS.
Addresses: https://github.com/util-linux/util-linux/issues/2049
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
| |
Let's introduce simple function to hide 'struct stat' if unnecessary.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
The classic mount(2) defaults to 'rw', but the new API does not reset
superblock to 'rw' if the flag is not explicitly used for
FSCONFIG_CMD_RECONFIGURE.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180593
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* reuse already open mount tree; the tree could be already open due to
regular mount, bind or remount operation
* umount (MNT_DETACH) old target if we created a clone (but the
operation is not a bind)
Adedreses: https://github.com/util-linux/util-linux/issues/2130
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |\
| |
| |
| |
| | |
* 'fixes' of https://github.com/brauner/util-linux:
idmap: kill child when writing the idmap fails
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This fixes the second issues reported in [1] where calling
mount -o 'X-mount.idmap=[...]' just hangs.
Fixes: https://github.com/util-linux/util-linux/issues/2130 [1]
Signed-off-by: Christian Brauner <brauner@kernel.org>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Always use MS_SECURE and MS_OWNERSECURE to mount fstab entries where
is specified "user" or "users", although the current user is root.
This bug has never been released (v2.39-rc1 only).
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The classic mount(MS_REMOUNT) means that all unspecified MS_NOxxx
flags are remove (except MS_NOATIME). We need to follow this semantic
when emulate remount by mount_setattr(), because "mount -o remount /"
is the way how (for example) systemd resets root filesystem to default
(e.g. ro->rw, etc.)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180593
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| |
| |
| |
| |
| | |
* move atime logic to optlist
* MOUNT_ATTR_RELATIME is zero, so we cannot use use "if (!attr)" to skip mount_setattr()
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| | |
| |
| |
| | |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |/
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Making libmount ingore autofs mounts by default can be a problem for
systemd, I remember now what the problem was.
autofs multi-mounts can be nested (and often are, think of a tree of
NFS exports) where there are autofs file system mounts within NFS
mounts and together with autofs mount triggers.
In this case systemd needs to see all the mounts at shutdown when it
is umounting the tree of mounts. We don't want to have to rely on
modifications having been made to systemd for this to work properly
so we can't make this the default behaviour in libmount.
Fixes: 22147e08c987 (libmount: use autofs mount hint to ignore autofs mount entries)
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: John Westerdale <jwesterd@redhat.com>
Cc: Frank Hertz <fhirtz@redhat.com>
Cc: Frank Sorenson <fsorenso@redhat.com>
|
| | |
|
| |
|
|
|
|
|
|
| |
It's technically valid to use xalloc.h in the tests, but then we mix
regular malloc and xalloc in the same source file, and it makes
"make checkxalloc" using difficult.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
| |
The current code writes to sock_fds[0], which is set to -1 on line 227, instead of the correct sock_fds[1].
As a cause, a simple `mount` command which uses idmapping and doesn't specify a user ns hangs indefinitely.
|
| |
|
|
|
|
|
|
|
|
| |
An alone "no" in the pattern is interpreted as an error; it should be also
valid in case the keyword is followed by a comma, e.g.
mnt_match_options("bla", "no,,");
Suggested-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* don't allocate and use a buffer for the pattern if the pattern is empty
* make it more obvious how empty pattern and empty optstr is evaluated
* add regression test
Reported-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
* convert selinux contexts to raw format during "prep-options" stage
* convert rootcontext=@target to raw context when final mountpoint
path is available (after mkdir).
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
| |
In some cases we have more hooks in the same stage and it's necessary
to call some hooks after another.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
| |
The final target (mountpoint) depends on others libmount functionality
(X-mount.mkdir or --target-prefix). It means we cannot assume target
when the library calls fix_opts() and translates selinux contexts.
The solution is extra hook executed after mkdir.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
| |
Add a special value for rootcontext=, namely `@target`, to set the root
context of the new filesystem to the current context of the target
mountpoint. Useful for in-memory filesystems, like tmpfs and ramfs.
Closes: #1830
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The new kernel mount API is not properly implemented in all FS
drivers. See strace output:
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sda", 0) = 0
fsconfig(3, FSCONFIG_SET_STRING, "context", "system_u:object_r:root_t:s0", 0) = 0
fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = -1 EINVAL (Invalid argument)
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
mount -o bind,ro=recursive,nosuid /foo /bar
sets all sub-mount to read-only, but only /bar will be nosuid.
Addresses: https://github.com/util-linux/util-linux/issues/1501
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
| |
Fixes: https://github.com/util-linux/util-linux/pull/2065
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
| |
Fixes: https://github.com/util-linux/util-linux/issues/2039
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The classic mount(2) based version uses MNT_ERR_APPLYFLAGS when not
able to set flags and errno is EINVAL. This is expected by
mnt_context_get_mount_excode() where libmount generates error messages
for mount(8).
Expected is:
# mount --make-private /mnt/test
mount: /mnt/test: not mount point or bad option.
rather than generic error:
mount: /mnt/test: wrong fs type, bad option, bad superblock on none ...
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
| |
Fixes: https://github.com/util-linux/util-linux/issues/1969
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
|
| |
Some mount options uses quotes due to commas in the value, for
example (SELinux) mount -o 'context="foo,bar"'.
Let's keep this parsed values without quotes in options list. It will
make things more simple.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
When we create a new namespace in a child process to persist it we need
to ensure that the child hangs around. During exit the child will drop
all references to its namespaces and so by the time we call open we
might already fail to open the namespace. Fix this.
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
|