mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Kernel: Support read-only filesystem mounts
This adds support for MS_RDONLY, a mount flag that tells the kernel to disallow any attempts to write to the newly mounted filesystem. As this flag is per-mount, and different mounts of the same filesystems (such as in case of bind mounts) can have different mutability settings, you have to go though a custody to find out if the filesystem is mounted read-only, instead of just asking the filesystem itself whether it's inherently read-only. This also adds a lot of checks we were previously missing; and moves some of them to happen after more specific checks (such as regular permission checks). One outstanding hole in this system is sys$mprotect(PROT_WRITE), as there's no way we can know if the original file description this region has been mounted from had been opened through a readonly mount point. Currently, we always allow such sys$mprotect() calls to succeed, which effectively allows anyone to circumvent the effect of MS_RDONLY. We should solve this one way or another.
This commit is contained in:
parent
b905126365
commit
fdb71cdf8f
6 changed files with 60 additions and 16 deletions
|
@ -52,6 +52,7 @@
|
|||
#define MS_NOEXEC (1 << 1)
|
||||
#define MS_NOSUID (1 << 2)
|
||||
#define MS_BIND (1 << 3)
|
||||
#define MS_RDONLY (1 << 4)
|
||||
|
||||
#define PERF_EVENT_MALLOC 1
|
||||
#define PERF_EVENT_FREE 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue