Commits

Stephen Smalley committed 1814d47

Revert "Mount selinuxfs on /sys/fs/selinux when possible."

This reverts commit cc3cc8e38e72923ee638995f60d2379f92aa629e.

  • Participants
  • Parent commits f5be8ff
  • Branches seandroid-4.0.4

Comments (0)

Files changed (3)

File include/selinux/selinux.h

    which performs the initial mount of selinuxfs. */
 void set_selinuxmnt(char *mnt);
 
+/* selinuxfs mountpoint */
+#define SELINUXMNT "/selinux"
+
 #ifdef __cplusplus
 }
 #endif

File src/android.c

 #include <selinux/label.h>
 #include <selinux/avc.h>
 #include <private/android_filesystem_config.h>
-#include "policy.h"
 #include "callbacks.h"
 #include "selinux_internal.h"
 
 
 int selinux_android_load_policy(void)
 {
-	char *mnt = SELINUXMNT;
-	int rc;
-	rc = mount(SELINUXFS, mnt, SELINUXFS, 0, NULL);
-	if (rc < 0) {
+	mkdir(SELINUXMNT, 0755);
+	if (mount("selinuxfs", SELINUXMNT, "selinuxfs", 0, NULL)) {
 		if (errno == ENODEV) {
 			/* SELinux not enabled in kernel */
 			return -1;
 		}
-		if (errno == ENOENT) {
-			/* Fall back to legacy mountpoint. */
-			mnt = OLDSELINUXMNT;
-			mkdir(mnt, 0755);
-			rc = mount(SELINUXFS, mnt, SELINUXFS, 0, NULL);
-		}
-	}
-	if (rc < 0) {
 		selinux_log(SELINUX_ERROR,"SELinux:  Could not mount selinuxfs:  %s\n",
 				strerror(errno));
 		return -1;
 	}
-	set_selinuxmnt(mnt);
+	set_selinuxmnt(SELINUXMNT);
 
 	return selinux_android_reload_policy();
 }

File src/policy.h

 /* selinuxfs magic number */
 #define SELINUX_MAGIC 0xf97cff8c
 
-/* Preferred selinuxfs mount point directory paths. */
-#define SELINUXMNT "/sys/fs/selinux"
-#define OLDSELINUXMNT "/selinux"
-
-/* selinuxfs filesystem type string. */
-#define SELINUXFS "selinuxfs"
-
-/* selinuxfs mount point determined at runtime */
+/* selinuxfs mount point */
 extern char *selinux_mnt;
 
-/* First version of policy supported in mainline Linux. */
+#define FILECONTEXTS "/etc/security/selinux/file_contexts"
+
 #define DEFAULT_POLICY_VERSION 15
 
 #endif