File: 64_init_selinux_enabled.patch

package info (click to toggle)
sysvinit 2.88dsf-59
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,300 kB
  • ctags: 1,736
  • sloc: ansic: 7,096; sh: 3,883; perl: 371; makefile: 315
file content (40 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
Purpose: Try to fix the logic used to enable SELinux
Authour: Petter Reinholdtsen
Fixes:   #580272
Status:  applied upstream

--- a/src/init.c
+++ b/src/init.c
@@ -54,10 +54,6 @@
 
 #ifdef WITH_SELINUX
 #  include <selinux/selinux.h>
-#  include <sys/mount.h>
-#  ifndef MNT_DETACH /* present in glibc 2.10, missing in 2.7 */
-#    define MNT_DETACH 2
-#  endif
 #endif
 
 #ifdef __i386__
@@ -2872,11 +2868,9 @@ int main(int argc, char **argv)
 
 #ifdef WITH_SELINUX
 	if (getenv("SELINUX_INIT") == NULL) {
-	  const int rc = mount("proc", "/proc", "proc", 0, 0);
-	  if (is_selinux_enabled() > 0) {
-	    putenv("SELINUX_INIT=YES");
-	    if (rc == 0) umount2("/proc", MNT_DETACH);
+	  if (is_selinux_enabled() != 1) {
 	    if (selinux_init_load_policy(&enforce) == 0) {
+	      putenv("SELINUX_INIT=YES");
 	      execv(myname, argv);
 	    } else {
 	      if (enforce > 0) {
@@ -2887,7 +2881,6 @@ int main(int argc, char **argv)
 	      }
 	    }
 	  }
-	  if (rc == 0) umount2("/proc", MNT_DETACH);
 	}
 #endif  
 	/* Start booting. */