From 057b94215ad703db32cc88cef24728b8aaab3bee Mon Sep 17 00:00:00 2001 From: Alex Hong Date: Tue, 20 Dec 2022 22:08:43 +0800 Subject: [PATCH] Reland "Set the log callback earlier for showing system property set denials" PropertyInit loads the build.prop files and set the system properties. Set the SELinux log callback before that to show the avc denials for debugging. Test: $ make init_system Push this module and ensure system property set denials are shown during boot Bug: 185920634 Bug: 211547922 Change-Id: If9f34d469d3da2ebdfe64bb611de85a3ca37e000 --- init/init.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/init.cpp b/init/init.cpp index 42621915e..f964c605d 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -952,6 +952,8 @@ int SecondStageMain(int argc, char** argv) { InitKernelLogging(argv); LOG(INFO) << "init second stage started!"; + SelinuxSetupKernelLogging(); + // Update $PATH in the case the second stage init is newer than first stage init, where it is // first set. if (setenv("PATH", _PATH_DEFPATH, 1) != 0) { @@ -1012,7 +1014,6 @@ int SecondStageMain(int argc, char** argv) { MountExtraFilesystems(); // Now set up SELinux for second stage. - SelinuxSetupKernelLogging(); SelabelInitialize(); SelinuxRestoreContext();