Skip to content

Commit

Permalink
fix: tmpfs default permissions
Browse files Browse the repository at this point in the history
Tmpfs uses shared mamory. The owner of it is system cgroup.
It can be broke the system, put the big file on it.

* set mount options to /tmp, /run folder as many OS have.
* limit /tmp size to 64Mb.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
sergelogvinov authored and smira committed Dec 6, 2021
1 parent 8f3e1a4 commit d225cf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/mount/pseudo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func PseudoMountPoints() (mountpoints *Points, err error) {
pseudo.Set("dev", NewMountPoint("devtmpfs", "/dev", "devtmpfs", unix.MS_NOSUID, "mode=0755"))
pseudo.Set("proc", NewMountPoint("proc", "/proc", "proc", unix.MS_NOSUID|unix.MS_NOEXEC|unix.MS_NODEV, ""))
pseudo.Set("sys", NewMountPoint("sysfs", "/sys", "sysfs", 0, ""))
pseudo.Set("run", NewMountPoint("tmpfs", "/run", "tmpfs", 0, "mode=755"))
pseudo.Set("run", NewMountPoint("tmpfs", "/run", "tmpfs", unix.MS_NOSUID|unix.MS_NOEXEC|unix.MS_RELATIME, "mode=755"))
pseudo.Set("system", NewMountPoint("tmpfs", "/system", "tmpfs", 0, "mode=755"))
pseudo.Set("tmp", NewMountPoint("tmpfs", "/tmp", "tmpfs", 0, "mode=755"))
pseudo.Set("tmp", NewMountPoint("tmpfs", "/tmp", "tmpfs", unix.MS_NOSUID|unix.MS_NOEXEC|unix.MS_NODEV, "size=64M,mode=755"))

return pseudo, nil
}
Expand Down

0 comments on commit d225cf9

Please sign in to comment.