Skip to content

Commit fc98317

Browse files
cgzonespcmoore
authored andcommitted
selinux: pre-allocate the status page
Since the status page is currently only allocated on first use, the sequence number of the initial policyload (i.e. 1) is not stored, leading to the observable sequence of 0, 2, 3, 4, ... Try to pre-allocate the status page during the initialization of the selinuxfs, so selinux_status_update_policyload() will set the sequence number. This brings the status page to return the actual sequence number for the initial policy load, which is also observable via the netlink socket. I could not find any occurrence where userspace depends on the actual value returned by selinux_status_policyload(3), thus the breakage should be unnoticed. Closes: https://lore.kernel.org/selinux/[email protected]/ Signed-off-by: Christian Göttsche <[email protected]> [PM: trimmed 'reported-by' that was missing an email] Signed-off-by: Paul Moore <[email protected]>
1 parent 4e551db commit fc98317

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

security/selinux/selinuxfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,12 @@ static int __init init_sel_fs(void)
21612161
selinux_null.dentry = NULL;
21622162
}
21632163

2164+
/*
2165+
* Try to pre-allocate the status page, so the sequence number of the
2166+
* initial policy load can be stored.
2167+
*/
2168+
(void) selinux_kernel_status_page();
2169+
21642170
return err;
21652171
}
21662172

0 commit comments

Comments
 (0)