|
| 1 | +From 6b25470ee28843a49c50442e9d8a98edc842ceca Mon Sep 17 00:00:00 2001 |
| 2 | +From: Yu Watanabe <watanabe.yu+github@gmail.com> |
| 3 | +Date: Mon, 20 Feb 2023 12:00:30 +0900 |
| 4 | +Subject: [PATCH] core/manager: run generators directly when we are in initrd |
| 5 | + |
| 6 | +Some initrd system write files at ourside of /run, /etc, or other |
| 7 | +allowed places. This is a kind of workaround, but in most cases, such |
| 8 | +sandboxing is not necessary as the filesystem is on ramfs when we are in |
| 9 | +initrd. |
| 10 | + |
| 11 | +Fixes #26488. |
| 12 | +--- |
| 13 | + src/core/manager.c | 4 ++-- |
| 14 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 15 | + |
| 16 | +diff --git a/src/core/manager.c b/src/core/manager.c |
| 17 | +index 7b394794b0d4..306477c6e6c2 100644 |
| 18 | +--- a/src/core/manager.c |
| 19 | ++++ b/src/core/manager.c |
| 20 | +@@ -3822,8 +3822,8 @@ static int manager_run_generators(Manager *m) { |
| 21 | + /* If we are the system manager, we fork and invoke the generators in a sanitized mount namespace. If |
| 22 | + * we are the user manager, let's just execute the generators directly. We might not have the |
| 23 | + * necessary privileges, and the system manager has already mounted /tmp/ and everything else for us. |
| 24 | +- */ |
| 25 | +- if (MANAGER_IS_USER(m)) { |
| 26 | ++ * If we are in initrd, let's also execute the generators directly, as we are in ramfs. */ |
| 27 | ++ if (MANAGER_IS_USER(m) || in_initrd()) { |
| 28 | + r = manager_execute_generators(m, paths, /* remount_ro= */ false); |
| 29 | + goto finish; |
| 30 | + } |
0 commit comments