]> git.ipfire.org Git - thirdparty/systemd.git/commit
execute: split out mounting of credentials fs
authorLennart Poettering <lennart@poettering.net>
Thu, 29 Jun 2023 10:32:44 +0000 (12:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 4 Jul 2023 21:03:24 +0000 (23:03 +0200)
commit1155f44f48f8fd59c863d71b3938e34a0b2fec2a
tree31d541ea0bdfcfafecbdc67e4faba3d6989e2808
parent7ca59e67b1c4f45cfe4827049ee4d009f33b362b
execute: split out mounting of credentials fs

Let's add two new helpers: mount_credentials_fs() and
credentials_fs_mount_flags(). The former mounts a file system suitable
for storing of unencrypted credentials at runtime (i.e. a ramfs or
tmpfs). The latter determines the right mount flags to use for such a
mount.

Both functions mostly just take code from execute.c, but make two
changes:

1. If the kernel supports it we'll use a tmpfs with the new "noswap"
   mount option instead of ramfs. Was added in kernel 6.4, hence is very
   recent, but tmpfs is so much less crappy than ramfs, hence worth it.

2. We'll set MS_NOSYMFOLLOW on the mounts if supported. These file
   systems should only contain regulra files, hence no need to allow
   symlinks.
src/core/execute.c
src/shared/mount-util.c
src/shared/mount-util.h