mirror of
https://github.com/systemd/systemd.git
synced 2025-08-24 09:49:49 +03:00
selinux: check PID 1 label instead of /selinux mount point to figure out if selinux is already initialized
This commit is contained in:
@ -38,11 +38,18 @@ int selinux_setup(char *const argv[]) {
|
|||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
int enforce = 0;
|
int enforce = 0;
|
||||||
usec_t n;
|
usec_t n;
|
||||||
|
security_context_t con;
|
||||||
|
|
||||||
/* Already initialized? */
|
/* Already initialized? */
|
||||||
if (path_is_mount_point("/sys/fs/selinux") > 0 ||
|
if (getcon_raw(&con) == 0) {
|
||||||
path_is_mount_point("/selinux") > 0)
|
bool initialized;
|
||||||
return 0;
|
|
||||||
|
initialized = !streq(con, "kernel");
|
||||||
|
freecon(con);
|
||||||
|
|
||||||
|
if (initialized)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Before we load the policy we create a flag file to ensure
|
/* Before we load the policy we create a flag file to ensure
|
||||||
* that after the reexec we iterate through /run and /dev to
|
* that after the reexec we iterate through /run and /dev to
|
||||||
|
Reference in New Issue
Block a user