summaryrefslogtreecommitdiff
path: root/Base
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-02-25 19:30:28 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2023-05-17 23:39:15 -0600
commit0bbd9040efbe97850a18a49a9cea25498d727f13 (patch)
tree6b02734b1736720b21903b81c5b0e5485675b2f8 /Base
parent04b44a827a2ec494995e6583fb398835cf887eb3 (diff)
downloadserenity-0bbd9040efbe97850a18a49a9cea25498d727f13.zip
Kernel+Userland: Split bind-mounting and re-mounting from mount syscall
These 2 are an actual separate types of syscalls, so let's stop using special flags for bind mounting or re-mounting and instead let userspace calling directly for this kind of actions.
Diffstat (limited to 'Base')
-rw-r--r--Base/usr/share/man/man2/bindmount.md39
-rw-r--r--Base/usr/share/man/man2/mount.md16
-rw-r--r--Base/usr/share/man/man2/remount.md39
3 files changed, 81 insertions, 13 deletions
diff --git a/Base/usr/share/man/man2/bindmount.md b/Base/usr/share/man/man2/bindmount.md
new file mode 100644
index 0000000000..17e9aa1a4f
--- /dev/null
+++ b/Base/usr/share/man/man2/bindmount.md
@@ -0,0 +1,39 @@
+## Name
+
+bindmount - create a bindmount from `source_fd` to a target path.
+
+## Synopsis
+
+```**c++
+#include <LibCore/System.h>
+
+ErrorOr<void> bindmount(int source_fd, StringView target, int flags);
+```
+
+## Description
+
+`bindmount()` create a bindmount from `source_fd` to a target path `target`, with mount flags of `flags`.
+
+The following `flags` are supported:
+
+* `MS_NODEV`: Disallow opening any devices from this file system.
+* `MS_NOEXEC`: Disallow executing any executables from this file system.
+* `MS_NOSUID`: Ignore set-user-id bits on executables from this file system.
+* `MS_RDONLY`: Mount the filesystem read-only.
+* `MS_WXALLOWED`: Allow W^X protection circumvention for executables on this file system.
+* `MS_AXALLOWED`: Allow anonymous executable mappings for executables on this file system.
+* `MS_NOREGULAR`: Disallow opening any regular files from this file system.
+
+These flags can be used as a security measure to limit the possible abuses of the mounted file system.
+
+## Errors
+
+* `EINVAL`: The `flags` value contains deprecated flags such as `MS_REMOUNT` or `MS_BIND`.
+* `EPERM`: The current process does not have superuser privileges.
+* `ENODEV`: The `source_fd` is not an open file descriptor to a valid filesystem inode.
+
+All of the usual path resolution errors may also occur.
+
+## See also
+
+* [`mount`(2)](help://man/2/mount)
diff --git a/Base/usr/share/man/man2/mount.md b/Base/usr/share/man/man2/mount.md
index ccbb66c520..b15b4fc870 100644
--- a/Base/usr/share/man/man2/mount.md
+++ b/Base/usr/share/man/man2/mount.md
@@ -34,9 +34,7 @@ The following `flags` are supported:
* `MS_NODEV`: Disallow opening any devices from this file system.
* `MS_NOEXEC`: Disallow executing any executables from this file system.
* `MS_NOSUID`: Ignore set-user-id bits on executables from this file system.
-* `MS_BIND`: Perform a bind-mount (see below).
* `MS_RDONLY`: Mount the filesystem read-only.
-* `MS_REMOUNT`: Remount an already mounted filesystem (see below).
* `MS_WXALLOWED`: Allow W^X protection circumvention for executables on this file system.
* `MS_AXALLOWED`: Allow anonymous executable mappings for executables on this file system.
* `MS_NOREGULAR`: Disallow opening any regular files from this file system.
@@ -57,11 +55,6 @@ itself, which may be useful for changing mount flags for a part of a filesystem.
### Remounting
-If `MS_REMOUNT` is specified in `flags`, `source_fd` and `fs_type` are ignored,
-and a remount is performed instead. `target` must point to an existing mount
-point. The mount flags for that mount point are reset to `flags` (except the
-`MS_REMOUNT` flag itself, which is stripped from the value).
-
Note that remounting a file system will only affect future operations with the
file system, not any already opened files. For example, if you open a directory
on a filesystem that's mounted with `MS_NODEV`, then remount the filesystem to
@@ -74,14 +67,9 @@ in mount flags of the underlying file system. To "refresh" the working directory
to use the new mount flags after remounting a filesystem, a process can call
`chdir()` with the path to the same directory.
-Similarly, to change the mount flags used by the root directory, a process can
-remount the root filesystem using `MS_REMOUNT`.
-However, it only have a noticeable effect if
-the kernel was to launch more userspace processes directly, the way it does
-launch the initial userspace process.
-
## Errors
+* `EINVAL`: The `flags` value contains deprecated flags such as `MS_REMOUNT` or `MS_BIND`.
* `EFAULT`: The `fs_type` or `target` are invalid strings.
* `EPERM`: The current process does not have superuser privileges.
* `ENODEV`: The `fs_type` is unrecognized, or the file descriptor to source is
@@ -99,3 +87,5 @@ All of the usual path resolution errors may also occur.
## See also
* [`mount`(8)](help://man/8/mount)
+* [`remount`(2)](help://man/2/remount)
+* [`bindmount`(2)](help://man/2/bindmount)
diff --git a/Base/usr/share/man/man2/remount.md b/Base/usr/share/man/man2/remount.md
new file mode 100644
index 0000000000..d4384caaf3
--- /dev/null
+++ b/Base/usr/share/man/man2/remount.md
@@ -0,0 +1,39 @@
+## Name
+
+remount - remount a filesystem with new mount flags
+
+## Synopsis
+
+```**c++
+#include <LibCore/System.h>
+
+ErrorOr<void> remount(StringView target, int flags);
+```
+
+## Description
+
+`remount()` mounts a filesystem that is mounted at `target` with new mount flags of `flags`.
+
+The following `flags` are supported:
+
+* `MS_NODEV`: Disallow opening any devices from this file system.
+* `MS_NOEXEC`: Disallow executing any executables from this file system.
+* `MS_NOSUID`: Ignore set-user-id bits on executables from this file system.
+* `MS_RDONLY`: Mount the filesystem read-only.
+* `MS_WXALLOWED`: Allow W^X protection circumvention for executables on this file system.
+* `MS_AXALLOWED`: Allow anonymous executable mappings for executables on this file system.
+* `MS_NOREGULAR`: Disallow opening any regular files from this file system.
+
+These flags can be used as a security measure to limit the possible abuses of the mounted file system.
+
+## Errors
+
+* `EINVAL`: The `flags` value contains deprecated flags such as `MS_REMOUNT` or `MS_BIND`.
+* `EPERM`: The current process does not have superuser privileges.
+* `ENODEV`: No mount point was found for `target` path target.
+
+All of the usual path resolution errors may also occur.
+
+## See also
+
+* [`mount`(2)](help://man/2/mount)