mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
Avoid remounting already mounted /run and /tmp directories
Adds the function fistmpfs to determine if a new tmpfs mount should be performed on /run and /tmp. The function supports cases where more complex mount hierarchies are in use, including overlayfs backed mounts. Signed-off-by: Mathias Thore <mathias.thore@atlascopco.com>
This commit is contained in:
1 parent
13b107b7b1
commit
a0685219cf
3 files changed
+19
-2
No files matched your search
+2
-2
@@ -409,7 +409,7 @@ static void fs_finalize(void)
|
||||
* To override any of this behavior, add entries to /etc/fstab
|
||||
* for /run (and optionally /run/lock).
|
||||
*/
|
||||
if (fisdir("/run") && !fismnt("/run")) {
|
||||
if (fisdir("/run") && !fismnt("/run") && !fistmpfs("/run")) {
|
||||
fs_mount("tmpfs", "/run", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_RELATIME, "mode=0755,size=10%");
|
||||
|
||||
/* This prevents user DoS of /run by filling /run/lock at the expense of another tmpfs, max 5MiB */
|
||||
@@ -418,7 +418,7 @@ static void fs_finalize(void)
|
||||
}
|
||||
|
||||
/* Modern systems use tmpfs for /tmp */
|
||||
if (!fismnt("/tmp"))
|
||||
if (!fismnt("/tmp") && !fistmpfs("/tmp"))
|
||||
fs_mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV, "mode=1777");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user