From 77f4a92530600e2c5287e0ffddace0ae224fba0e Mon Sep 17 00:00:00 2001 From: Qiheng Lin Date: Fri, 2 Dec 2022 10:33:09 +0800 Subject: [PATCH] init: session keyring move to SystemInit() As some platforms don't have first stage init, move KeyCtrlGetKeyringId() to SystemInit(). Signed-off-by: Qiheng Lin Change-Id: Ida2f422be564b6a6b1d26535cb982b7f85c49d33 --- services/init/standard/init.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/init/standard/init.c b/services/init/standard/init.c index 3f7772b9..d3d9d467 100755 --- a/services/init/standard/init.c +++ b/services/init/standard/init.c @@ -94,6 +94,10 @@ static int FdHolderSockInit(void) void SystemInit(void) { SignalInit(); + + // Set up a session keyring that all processes will have access to. + KeyCtrlGetKeyringId(KEY_SPEC_SESSION_KEYRING, 1); + // umask call always succeeds and return the previous mask value which is not needed here (void)umask(DEFAULT_UMASK_INIT); MakeDirRecursive("/dev/unix/socket", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); @@ -199,9 +203,6 @@ static void StartInitSecondStage(void) // It will panic if close stdio before execv("/bin/sh", NULL) CloseStdio(); - // Set up a session keyring that all processes will have access to. - KeyCtrlGetKeyringId(KEY_SPEC_SESSION_KEYRING, 1); - #ifndef DISABLE_INIT_TWO_STAGES INIT_LOGI("Start init second stage."); SwitchRoot("/usr"); -- GitLab