summaryrefslogtreecommitdiffstats
path: root/recipes-security/selinux/libselinux/libselinux-fix-init-load-policy.patch
blob: 67e32d6998eb32052121501dd5e513ff3df689d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From ac70ca3b336b52b01cdc38157d25bf7e85098ee1 Mon Sep 17 00:00:00 2001
From: Xin Ouyang <Xin.Ouyang@windriver.com>
Date: Thu, 12 Apr 2012 16:10:10 +0800
Subject: [PATCH] libselinux: fix init load policy

selinux_init_load_policy() would fail if we use the new mount point
for selinuxfs(/sys/fs/selinux) while sysfs(/sys) is still not
mounted.
---
 src/load_policy.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/load_policy.c b/src/load_policy.c
index f569664..60e7efd 100644
--- a/src/load_policy.c
+++ b/src/load_policy.c
@@ -370,6 +370,7 @@ int selinux_init_load_policy(int *enforce)
 	 * mount it if present for use in the calls below.  
 	 */
	const char *mntpoint = NULL;
+	rc = mount("sysfs", "/sys", "sysfs", 0, 0);
 	if (mount(SELINUXFS, SELINUXMNT, SELINUXFS, 0, 0) == 0 || errno == EBUSY) {
 		mntpoint = SELINUXMNT;
 	} else {
-- 
1.7.5.4