Kernel+Userland: Prepare for considering VFSRootContext when mounting

Expose some initial interfaces in the mount-related syscalls to select
the desired VFSRootContext, by specifying the VFSRootContext index
number.

For now there's still no way to create a different VFSRootContext, so
the only valid IDs are -1 (for currently attached VFSRootContext) or 1
for the first userspace VFSRootContext.
This commit is contained in:
Liav A. authored and Tim Schumacher committed 2024-07-21 11:44:23 +02:00
1 parent 01e1af732b
commit 91c87c5b77
13 files changed
+144 -53

No files matched your search

+8
View File
@@ -439,22 +439,30 @@ struct SC_fsopen_params {
};
struct SC_fsmount_params {
int vfs_root_context_id;
int mount_fd;
StringArgument target;
int source_fd;
};
struct SC_bindmount_params {
int vfs_root_context_id;
StringArgument target;
int source_fd;
int flags;
};
struct SC_remount_params {
int vfs_root_context_id;
StringArgument target;
int flags;
};
struct SC_umount_params {
int vfs_root_context_id;
StringArgument target;
};
struct SC_pledge_params {
StringArgument promises;
StringArgument execpromises;
+1
View File
@@ -67,6 +67,7 @@ public:
SpinlockProtected<IntrusiveList<&FileSystem::m_file_system_node>, LockRank::FileSystem>& all_file_systems_list(Badge<VFSRootContext>) { return m_file_systems_list; }
SpinlockProtected<IntrusiveList<&VFSRootContext::m_list_node>, LockRank::FileSystem>& all_root_contexts_list(Badge<PowerStateSwitchTask>) { return m_root_contexts; }
SpinlockProtected<IntrusiveList<&VFSRootContext::m_list_node>, LockRank::FileSystem>& all_root_contexts_list(Badge<VFSRootContext>) { return m_root_contexts; }
SpinlockProtected<IntrusiveList<&VFSRootContext::m_list_node>, LockRank::FileSystem>& all_root_contexts_list(Badge<Process>) { return m_root_contexts; }
ErrorOr<void> mount(VFSRootContext&, MountFile&, OpenFileDescription*, Custody& mount_point, int flags);
ErrorOr<void> pivot_root_by_copying_mounted_fs_instance(VFSRootContext&, FileSystem& fs, int root_mount_flags);
+11 -13
View File
@@ -55,10 +55,9 @@ ErrorOr<FlatPtr> Process::sys$fsmount(Userspace<Syscall::SC_fsmount_params const
RefPtr<OpenFileDescription> source_description = TRY(open_file_description_ignoring_negative(params.source_fd));
auto target = TRY(try_copy_kstring_from_user(params.target));
auto current_vfs_root_context = Process::current().vfs_root_context();
auto target_custody = TRY(VirtualFileSystem::the().resolve_path(current_vfs_root_context, credentials, target->view(), current_directory()));
auto mount_target_context = TRY(context_for_mount_operation(params.vfs_root_context_id, target->view()));
auto flags = mount_description->mount_file()->mount_flags();
TRY(VirtualFileSystem::the().mount(current_vfs_root_context, *mount_description->mount_file(), source_description.ptr(), target_custody, flags));
TRY(VirtualFileSystem::the().mount(mount_target_context.vfs_root_context, *mount_description->mount_file(), source_description.ptr(), mount_target_context.custody, flags));
return 0;
}
@@ -78,8 +77,8 @@ ErrorOr<FlatPtr> Process::sys$remount(Userspace<Syscall::SC_remount_params const
auto target = TRY(try_copy_kstring_from_user(params.target));
auto current_vfs_root_context = Process::current().vfs_root_context();
auto target_custody = TRY(VirtualFileSystem::the().resolve_path(current_vfs_root_context, credentials, target->view(), current_directory()));
TRY(VirtualFileSystem::the().remount(current_vfs_root_context, target_custody, params.flags));
auto mount_target_context = TRY(context_for_mount_operation(params.vfs_root_context_id, target->view()));
TRY(VirtualFileSystem::the().remount(mount_target_context.vfs_root_context, mount_target_context.custody, params.flags));
return 0;
}
@@ -99,8 +98,7 @@ ErrorOr<FlatPtr> Process::sys$bindmount(Userspace<Syscall::SC_bindmount_params c
auto source_fd = params.source_fd;
auto target = TRY(try_copy_kstring_from_user(params.target));
auto current_vfs_root_context = Process::current().vfs_root_context();
auto target_custody = TRY(VirtualFileSystem::the().resolve_path(current_vfs_root_context, credentials, target->view(), current_directory()));
auto mount_target_context = TRY(context_for_mount_operation(params.vfs_root_context_id, target->view()));
auto description = TRY(open_file_description(source_fd));
if (!description->custody()) {
@@ -108,11 +106,11 @@ ErrorOr<FlatPtr> Process::sys$bindmount(Userspace<Syscall::SC_bindmount_params c
return ENODEV;
}
TRY(VirtualFileSystem::the().bind_mount(current_vfs_root_context, *description->custody(), target_custody, params.flags));
TRY(VirtualFileSystem::the().bind_mount(mount_target_context.vfs_root_context, *description->custody(), mount_target_context.custody, params.flags));
return 0;
}
ErrorOr<FlatPtr> Process::sys$umount(Userspace<char const*> user_mountpoint, size_t mountpoint_length)
ErrorOr<FlatPtr> Process::sys$umount(Userspace<Syscall::SC_umount_params const*> user_params)
{
VERIFY_NO_PROCESS_BIG_LOCK(this);
auto credentials = this->credentials();
@@ -121,10 +119,10 @@ ErrorOr<FlatPtr> Process::sys$umount(Userspace<char const*> user_mountpoint, siz
TRY(require_promise(Pledge::mount));
auto mountpoint = TRY(get_syscall_path_argument(user_mountpoint, mountpoint_length));
auto current_vfs_root_context = Process::current().vfs_root_context();
auto custody = TRY(VirtualFileSystem::the().resolve_path(current_vfs_root_context, credentials, mountpoint->view(), current_directory()));
TRY(VirtualFileSystem::the().unmount(current_vfs_root_context, custody));
auto params = TRY(copy_typed_from_user(user_params));
auto target = TRY(try_copy_kstring_from_user(params.target));
auto mount_target_context = TRY(context_for_mount_operation(params.vfs_root_context_id, target->view()));
TRY(VirtualFileSystem::the().unmount(mount_target_context.vfs_root_context, mount_target_context.custody));
return 0;
}
+62
View File
@@ -23,6 +23,7 @@
#include <Kernel/Interrupts/InterruptDisabler.h>
#include <Kernel/KSyms.h>
#include <Kernel/Library/KBufferBuilder.h>
#include <Kernel/Library/KLexicalPath.h>
#include <Kernel/Library/Panic.h>
#include <Kernel/Library/StdLib.h>
#include <Kernel/Memory/AnonymousVMObject.h>
@@ -1208,6 +1209,67 @@ RefPtr<Custody const> Process::executable() const
return m_executable.with([](auto& executable) { return executable; });
}
ErrorOr<NonnullRefPtr<VFSRootContext>> Process::vfs_root_context_for_id(int id)
{
if (id == -1)
return vfs_root_context();
// NOTE: ID 0 is reserved for the kernel VFS root context and is not
// addressable via the vfs root contexts list anyway.
// Because we checked for the special ID (-1), anything not above it
// is also considered illegal.
if (id == 0 || id < 0)
return EINVAL;
// NOTE: Jailed processes should not be able to specify any vfs root context
// besides their currently attached contexts.
// This is a security measure to prevent jailed processes from enumerating
// the list of VFSRootContexts.
if (is_currently_in_jail() && id != -1)
return EPERM;
return VirtualFileSystem::the().all_root_contexts_list(Badge<Process> {}).with([id](auto& list) -> ErrorOr<NonnullRefPtr<VFSRootContext>> {
for (auto& context : list) {
if (context.id() == static_cast<u64>(id))
return context;
}
return Error::from_errno(EDOM);
});
}
ErrorOr<NonnullRefPtr<VFSRootContext>> Process::acquire_vfs_root_context_for_id_and_validate_path(bool& different_vfs_root_context, int id, StringView path)
{
// NOTE: We don't support mount operations in different VFSRootContext(s) other
// than the Process::current VFSRootContext when the target path
// is not absolute, as the path probably doesn't correlate to anything
// meaningful on the other VFSRootContext.
auto context = TRY(vfs_root_context_for_id(id));
return m_attached_vfs_root_context.with([&different_vfs_root_context, path, context](auto& current_context) -> ErrorOr<NonnullRefPtr<VFSRootContext>> {
VERIFY(current_context);
different_vfs_root_context = (current_context.ptr() != context.ptr());
if (!KLexicalPath::is_absolute(path) && different_vfs_root_context)
return Error::from_errno(EINVAL);
return context;
});
}
ErrorOr<Process::MountTargetContext> Process::context_for_mount_operation(int vfs_root_context_id, StringView path)
{
bool different_vfs_root_context = false;
auto vfs_root_context = TRY(acquire_vfs_root_context_for_id_and_validate_path(different_vfs_root_context, vfs_root_context_id, path));
RefPtr<Custody> target_custody;
if (different_vfs_root_context) {
VERIFY(KLexicalPath::is_canonical(path));
auto vfs_root_context_custody = vfs_root_context->root_custody().with([](auto& custody) -> NonnullRefPtr<Custody> {
return custody;
});
target_custody = TRY(VirtualFileSystem::the().resolve_path(vfs_root_context, credentials(), path, vfs_root_context_custody));
} else {
target_custody = TRY(VirtualFileSystem::the().resolve_path(vfs_root_context, credentials(), path, current_directory()));
}
return MountTargetContext { *target_custody.release_nonnull(), *vfs_root_context };
}
ErrorOr<NonnullRefPtr<Custody>> Process::custody_for_dirfd(Badge<CustodyBase>, int dirfd)
{
return custody_for_dirfd(dirfd);
+10 -1
View File
@@ -434,7 +434,7 @@ public:
ErrorOr<FlatPtr> sys$rmdir(Userspace<char const*> pathname, size_t path_length);
ErrorOr<FlatPtr> sys$fsmount(Userspace<Syscall::SC_fsmount_params const*>);
ErrorOr<FlatPtr> sys$fsopen(Userspace<Syscall::SC_fsopen_params const*>);
ErrorOr<FlatPtr> sys$umount(Userspace<char const*> mountpoint, size_t mountpoint_length);
ErrorOr<FlatPtr> sys$umount(Userspace<Syscall::SC_umount_params const*>);
ErrorOr<FlatPtr> sys$chmod(Userspace<Syscall::SC_chmod_params const*>);
ErrorOr<FlatPtr> sys$fchmod(int fd, mode_t);
ErrorOr<FlatPtr> sys$chown(Userspace<Syscall::SC_chown_params const*>);
@@ -933,6 +933,15 @@ public:
private:
ErrorOr<NonnullRefPtr<Custody>> custody_for_dirfd(int dirfd);
ErrorOr<NonnullRefPtr<VFSRootContext>> vfs_root_context_for_id(int id);
ErrorOr<NonnullRefPtr<VFSRootContext>> acquire_vfs_root_context_for_id_and_validate_path(bool& different_vfs_root_context, int id, StringView path);
struct MountTargetContext {
NonnullRefPtr<Custody> custody;
NonnullRefPtr<VFSRootContext> vfs_root_context;
};
ErrorOr<MountTargetContext> context_for_mount_operation(int vfs_root_context_id, StringView path);
SpinlockProtected<Thread::ListInProcess, LockRank::None>& thread_list() { return m_thread_list; }
SpinlockProtected<Thread::ListInProcess, LockRank::None> const& thread_list() const { return m_thread_list; }
+11 -5
View File
@@ -959,7 +959,7 @@ int fsopen(char const* fs_type, int flags)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int fsmount(int mount_fd, int source_fd, char const* target)
int fsmount(int vfs_context_id, int mount_fd, int source_fd, char const* target)
{
if (!target) {
errno = EFAULT;
@@ -967,6 +967,7 @@ int fsmount(int mount_fd, int source_fd, char const* target)
}
Syscall::SC_fsmount_params params {
vfs_context_id,
mount_fd,
{ target, strlen(target) },
source_fd,
@@ -975,7 +976,7 @@ int fsmount(int mount_fd, int source_fd, char const* target)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int bindmount(int source_fd, char const* target, int flags)
int bindmount(int vfs_context_id, int source_fd, char const* target, int flags)
{
if (!target) {
errno = EFAULT;
@@ -983,6 +984,7 @@ int bindmount(int source_fd, char const* target, int flags)
}
Syscall::SC_bindmount_params params {
vfs_context_id,
{ target, strlen(target) },
source_fd,
flags,
@@ -994,18 +996,22 @@ int bindmount(int source_fd, char const* target, int flags)
int mount(int source_fd, char const* target, char const* fs_type, int flags)
{
if (flags & MS_BIND)
return bindmount(source_fd, target, flags);
return bindmount(-1, source_fd, target, flags);
int mount_fd = fsopen(fs_type, flags);
if (mount_fd < 0)
return -1;
return fsmount(mount_fd, source_fd, target);
return fsmount(-1, mount_fd, source_fd, target);
}
int umount(char const* mountpoint)
{
int rc = syscall(SC_umount, mountpoint, strlen(mountpoint));
Syscall::SC_umount_params params {
-1,
{ mountpoint, strlen(mountpoint) },
};
int rc = syscall(SC_umount, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+2 -2
View File
@@ -119,8 +119,8 @@ int fchownat(int fd, char const* pathname, uid_t uid, gid_t gid, int flags);
int ftruncate(int fd, off_t length);
int truncate(char const* path, off_t length);
int fsopen(char const* fs_type, int flags);
int fsmount(int mount_fd, int source_fd, char const* target);
int bindmount(int source_fd, char const* target, int flags);
int fsmount(int vfs_context_id, int mount_fd, int source_fd, char const* target);
int bindmount(int vfs_context_id, int source_fd, char const* target, int flags);
int mount(int source_fd, char const* target, char const* fs_type, int flags);
int umount(char const* mountpoint);
int pledge(char const* promises, char const* execpromises);
+16 -9
View File
@@ -261,12 +261,13 @@ ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destinati
HANDLE_SYSCALL_RETURN_VALUE("ptrace_peekbuf", rc, {});
}
ErrorOr<void> bindmount(int source_fd, StringView target, int flags)
ErrorOr<void> bindmount(Optional<i32> vfs_context_id, int source_fd, StringView target, int flags)
{
if (target.is_null())
return Error::from_errno(EFAULT);
Syscall::SC_bindmount_params params {
vfs_context_id.value_or(-1),
{ target.characters_without_null_termination(), target.length() },
source_fd,
flags,
@@ -275,12 +276,13 @@ ErrorOr<void> bindmount(int source_fd, StringView target, int flags)
HANDLE_SYSCALL_RETURN_VALUE("bindmount", rc, {});
}
ErrorOr<void> remount(StringView target, int flags)
ErrorOr<void> remount(Optional<i32> vfs_context_id, StringView target, int flags)
{
if (target.is_null())
return Error::from_errno(EFAULT);
Syscall::SC_remount_params params {
vfs_context_id.value_or(-1),
{ target.characters_without_null_termination(), target.length() },
flags
};
@@ -288,21 +290,21 @@ ErrorOr<void> remount(StringView target, int flags)
HANDLE_SYSCALL_RETURN_VALUE("remount", rc, {});
}
ErrorOr<void> mount(int source_fd, StringView target, StringView fs_type, int flags)
ErrorOr<void> mount(Optional<i32> vfs_context_id, int source_fd, StringView target, StringView fs_type, int flags)
{
if (target.is_null() || fs_type.is_null())
return Error::from_errno(EFAULT);
if (flags & MS_REMOUNT) {
TRY(remount(target, flags));
TRY(remount(vfs_context_id, target, flags));
return {};
}
if (flags & MS_BIND) {
TRY(bindmount(source_fd, target, flags));
TRY(bindmount(vfs_context_id, source_fd, target, flags));
return {};
}
int mount_fd = TRY(fsopen(fs_type, flags));
return fsmount(mount_fd, source_fd, target);
return fsmount(vfs_context_id, mount_fd, source_fd, target);
}
ErrorOr<int> fsopen(StringView fs_type, int flags)
@@ -318,12 +320,13 @@ ErrorOr<int> fsopen(StringView fs_type, int flags)
HANDLE_SYSCALL_RETURN_VALUE("fsopen", rc, rc);
}
ErrorOr<void> fsmount(int mount_fd, int source_fd, StringView target)
ErrorOr<void> fsmount(Optional<i32> vfs_context_id, int mount_fd, int source_fd, StringView target)
{
if (target.is_null())
return Error::from_errno(EFAULT);
Syscall::SC_fsmount_params params {
vfs_context_id.value_or(-1),
mount_fd,
{ target.characters_without_null_termination(), target.length() },
source_fd,
@@ -332,12 +335,16 @@ ErrorOr<void> fsmount(int mount_fd, int source_fd, StringView target)
HANDLE_SYSCALL_RETURN_VALUE("fsmount", rc, {});
}
ErrorOr<void> umount(StringView mount_point)
ErrorOr<void> umount(Optional<i32> vfs_context_id, StringView mount_point)
{
if (mount_point.is_null())
return Error::from_errno(EFAULT);
int rc = syscall(SC_umount, mount_point.characters_without_null_termination(), mount_point.length());
Syscall::SC_umount_params params {
vfs_context_id.value_or(-1),
{ mount_point.characters_without_null_termination(), mount_point.length() },
};
int rc = syscall(SC_umount, &params);
HANDLE_SYSCALL_RETURN_VALUE("umount", rc, {});
}
+5 -5
View File
@@ -58,12 +58,12 @@ ErrorOr<void> unveil_after_exec(StringView path, StringView permissions);
ErrorOr<void> sendfd(int sockfd, int fd);
ErrorOr<int> recvfd(int sockfd, int options);
ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf);
ErrorOr<void> mount(int source_fd, StringView target, StringView fs_type, int flags);
ErrorOr<void> bindmount(int source_fd, StringView target, int flags);
ErrorOr<void> mount(Optional<i32> vfs_context_id, int source_fd, StringView target, StringView fs_type, int flags);
ErrorOr<void> bindmount(Optional<i32> vfs_context_id, int source_fd, StringView target, int flags);
ErrorOr<int> fsopen(StringView fs_type, int flags);
ErrorOr<void> fsmount(int mount_fd, int source_fd, StringView target_path);
ErrorOr<void> remount(StringView target, int flags);
ErrorOr<void> umount(StringView mount_point);
ErrorOr<void> fsmount(Optional<i32> vfs_context_id, int mount_fd, int source_fd, StringView target_path);
ErrorOr<void> remount(Optional<i32> vfs_context_id, StringView target, int flags);
ErrorOr<void> umount(Optional<i32> vfs_context_id, StringView mount_point);
ErrorOr<long> ptrace(int request, pid_t tid, void* address, void* data);
ErrorOr<void> disown(pid_t pid);
ErrorOr<void> profiling_enable(pid_t, u64 event_mask);
+1 -1
View File
@@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(set_mount_flag("fd", fd, mount_fd));
TRY(set_mount_flag("rootmode", 40000, mount_fd));
TRY(Core::System::fsmount(mount_fd, -1, target));
TRY(Core::System::fsmount({}, mount_fd, -1, target));
return 0;
}
+8 -8
View File
@@ -18,11 +18,11 @@
static ErrorOr<void> prepare_bare_minimum_filesystem_mounts()
{
TRY(Core::System::remount("/"sv, MS_NODEV | MS_NOSUID | MS_RDONLY));
TRY(Core::System::mount(-1, "/proc"sv, "proc"sv, MS_NOSUID));
TRY(Core::System::mount(-1, "/sys"sv, "sys"sv, 0));
TRY(Core::System::mount(-1, "/dev"sv, "ram"sv, MS_NOSUID | MS_NOEXEC | MS_NOREGULAR));
TRY(Core::System::mount(-1, "/tmp"sv, "ram"sv, MS_NOSUID | MS_NODEV));
TRY(Core::System::remount({}, "/"sv, MS_NODEV | MS_NOSUID | MS_RDONLY));
TRY(Core::System::mount({}, -1, "/proc"sv, "proc"sv, MS_NOSUID));
TRY(Core::System::mount({}, -1, "/sys"sv, "sys"sv, 0));
TRY(Core::System::mount({}, -1, "/dev"sv, "ram"sv, MS_NOSUID | MS_NOEXEC | MS_NOREGULAR));
TRY(Core::System::mount({}, -1, "/tmp"sv, "ram"sv, MS_NOSUID | MS_NODEV));
// NOTE: Set /tmp to have a sticky bit with 0777 permissions.
TRY(Core::System::chmod("/tmp"sv, 01777));
return {};
@@ -55,7 +55,7 @@ static ErrorOr<void> prepare_tmpfs_system_devicemap_directory()
TRY(Core::System::mkdir("/tmp/system/"sv, 0755));
TRY(Core::System::mkdir("/tmp/system/devicemap/"sv, 0755));
TRY(Core::System::mount(-1, "/tmp/system/devicemap/"sv, "ram"sv, MS_NOEXEC | MS_NOSUID | MS_NODEV));
TRY(Core::System::mount({}, -1, "/tmp/system/devicemap/"sv, "ram"sv, MS_NOEXEC | MS_NOSUID | MS_NODEV));
TRY(Core::System::mkdir("/tmp/system/devicemap/nodes/"sv, 0755));
TRY(Core::System::mkdir("/tmp/system/devicemap/nodes/block/"sv, 0755));
TRY(Core::System::mkdir("/tmp/system/devicemap/nodes/char/"sv, 0755));
@@ -114,9 +114,9 @@ static ErrorOr<void> prepare_bare_minimum_devtmpfs_directory_structure()
TRY(Core::System::symlink("/proc/self/fd/2"sv, "/dev/stderr"sv));
TRY(Core::System::mkdir("/dev/gpu"sv, 0755));
TRY(Core::System::mkdir("/dev/pts"sv, 0755));
TRY(Core::System::mount(-1, "/dev/pts"sv, "devpts"sv, 0));
TRY(Core::System::mount({}, -1, "/dev/pts"sv, "devpts"sv, 0));
TRY(Core::System::mkdir("/dev/loop"sv, 0755));
TRY(Core::System::mount(-1, "/dev/loop"sv, "devloop"sv, 0));
TRY(Core::System::mount({}, -1, "/dev/loop"sv, "devloop"sv, 0));
mode_t old_mask = umask(0);
TRY(populate_device_node_with_symlink(DeviceNodeType::Character, "/dev/devctl"sv, 0660, 2, 10));
+8 -8
View File
@@ -101,11 +101,11 @@ static bool mount_by_line(ByteString const& line)
ErrorOr<void> error_or_void;
if (flags & MS_BIND)
error_or_void = Core::System::bindmount(fd, mountpoint, flags & ~MS_BIND);
error_or_void = Core::System::bindmount({}, fd, mountpoint, flags & ~MS_BIND);
else if (flags & MS_REMOUNT)
error_or_void = Core::System::remount(mountpoint, flags & ~MS_REMOUNT);
error_or_void = Core::System::remount({}, mountpoint, flags & ~MS_REMOUNT);
else
error_or_void = Core::System::mount(fd, mountpoint, fstype, flags);
error_or_void = Core::System::mount({}, fd, mountpoint, fstype, flags);
if (error_or_void.is_error()) {
warnln("Failed to mount {} (FD: {}) ({}) on {}: {}", filename, fd, fstype, mountpoint, error_or_void.error());
@@ -212,7 +212,7 @@ static ErrorOr<void> mount_using_loop_device(int inode_fd, StringView mountpoint
auto loop_device_path = TRY(String::formatted("/dev/loop/{}", loop_device_index));
int loop_device_fd = TRY(Core::System::open(loop_device_path.bytes_as_string_view(), O_RDONLY));
auto result = Core::System::mount(loop_device_fd, mountpoint, fs_type, flags);
auto result = Core::System::mount({}, loop_device_fd, mountpoint, fs_type, flags);
TRY(Core::System::ioctl(devctl_fd, DEVCTL_DESTROY_LOOP_DEVICE, &loop_device_index));
return result;
}
@@ -247,7 +247,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
int flags = !options.is_empty() ? parse_options(options) : 0;
if (!(flags & MS_REMOUNT))
return Error::from_string_literal("Expected valid source.");
TRY(Core::System::remount(mountpoint, flags & ~MS_REMOUNT));
TRY(Core::System::remount({}, mountpoint, flags & ~MS_REMOUNT));
return 0;
}
@@ -256,9 +256,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
int const fd = TRY(get_source_fd(source));
if (flags & MS_BIND) {
TRY(Core::System::bindmount(fd, mountpoint, flags & ~MS_BIND));
TRY(Core::System::bindmount({}, fd, mountpoint, flags & ~MS_BIND));
} else if (flags & MS_REMOUNT) {
TRY(Core::System::remount(mountpoint, flags & ~MS_REMOUNT));
TRY(Core::System::remount({}, mountpoint, flags & ~MS_REMOUNT));
} else {
if (fs_type.is_empty())
fs_type = "ext2"sv;
@@ -269,7 +269,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 0;
}
}
TRY(Core::System::mount(fd, mountpoint, fs_type, flags));
TRY(Core::System::mount({}, fd, mountpoint, fs_type, flags));
}
return 0;
}
+1 -1
View File
@@ -16,6 +16,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_positional_argument(mount_point, "Mount point", "mountpoint");
args_parser.parse(arguments);
TRY(Core::System::umount(mount_point));
TRY(Core::System::umount({}, mount_point));
return 0;
}