mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 22:09:30 +02:00
security: lsm: allow LSMs to register for late_initcall_sync init
There are situations where LSMs have dependencies that might mean they want to be initialised later in the boot process, to ensure those dependencies are available. In particular there are some TPM setups (Arm FF-A devices, SPI attached TPMs) required by IMA which are not guaranteed to be initialised for regular initcall_late. Add an initcall_late_sync option that can be used in these situations. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Cc: Paul Moore <paul@paul-moore.com> Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
@@ -167,6 +167,7 @@ enum lsm_order {
|
||||
* @initcall_fs: LSM callback for fs_initcall setup, optional
|
||||
* @initcall_device: LSM callback for device_initcall() setup, optional
|
||||
* @initcall_late: LSM callback for late_initcall() setup, optional
|
||||
* @initcall_late_sync: LSM callback for late_initcall_sync() setup, optional
|
||||
*/
|
||||
struct lsm_info {
|
||||
const struct lsm_id *id;
|
||||
@@ -182,6 +183,7 @@ struct lsm_info {
|
||||
int (*initcall_fs)(void);
|
||||
int (*initcall_device)(void);
|
||||
int (*initcall_late)(void);
|
||||
int (*initcall_late_sync)(void);
|
||||
};
|
||||
|
||||
#define DEFINE_LSM(lsm) \
|
||||
|
||||
+11
-2
@@ -556,13 +556,22 @@ device_initcall(security_initcall_device);
|
||||
* security_initcall_late - Run the LSM late initcalls
|
||||
*/
|
||||
static int __init security_initcall_late(void)
|
||||
{
|
||||
return lsm_initcall(late);
|
||||
}
|
||||
late_initcall(security_initcall_late);
|
||||
|
||||
/**
|
||||
* security_initcall_late_sync - Run the LSM late initcalls sync
|
||||
*/
|
||||
static int __init security_initcall_late_sync(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = lsm_initcall(late);
|
||||
rc = lsm_initcall(late_sync);
|
||||
lsm_pr_dbg("all enabled LSMs fully activated\n");
|
||||
call_blocking_lsm_notifier(LSM_STARTED_ALL, NULL);
|
||||
|
||||
return rc;
|
||||
}
|
||||
late_initcall(security_initcall_late);
|
||||
late_initcall_sync(security_initcall_late_sync);
|
||||
|
||||
Reference in New Issue
Block a user