summaryrefslogtreecommitdiff
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorFan Wu <wufan@linux.microsoft.com>2024-08-02 23:08:19 -0700
committerPaul Moore <paul@paul-moore.com>2024-08-20 14:01:41 -0400
commit2fea0c26b82f304f43b3905e56d954cf98a6d0e9 (patch)
tree75d2e25539d522736a0fa0d878ee67cae2f7cb8e /init/initramfs.c
parent52443cb60c356707df494910fa134bbb0a8b1a66 (diff)
initramfs,lsm: add a security hook to do_populate_rootfs()
This patch introduces a new hook to notify security system that the content of initramfs has been unpacked into the rootfs. Upon receiving this notification, the security system can activate a policy to allow only files that originated from the initramfs to execute or load into kernel during the early stages of booting. This approach is crucial for minimizing the attack surface by ensuring that only trusted files from the initramfs are operational in the critical boot phase. Signed-off-by: Fan Wu <wufan@linux.microsoft.com> [PM: subject line tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 814241b64827..bc911e466d5b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -17,6 +17,7 @@
#include <linux/namei.h>
#include <linux/init_syscalls.h>
#include <linux/umh.h>
+#include <linux/security.h>
#include "do_mounts.h"
@@ -712,6 +713,8 @@ static void __init do_populate_rootfs(void *unused, async_cookie_t cookie)
}
done:
+ security_initramfs_populated();
+
/*
* If the initrd region is overlapped with crashkernel reserved region,
* free only memory that is not part of crashkernel region.