summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Roberts <william.c.roberts@intel.com>2015-07-23 02:07:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-23 02:07:01 +0000
commit09fbb9669af14fd9bb97234ec518f8ac91819368 (patch)
treeb865b424c7c0e7a7bc82cd40a8b7c9610926daf9
parentdc022606befb80fd6c8a10312b79cedbc40dddab (diff)
parentbe86166f7e4f49cb0cb0c97a368377b4d781998a (diff)
downloadlibselinux-09fbb9669af14fd9bb97234ec518f8ac91819368.tar.gz
am be86166f: restorecon: do not set security.restorecon_last on ramfs and tmpfs
* commit 'be86166f7e4f49cb0cb0c97a368377b4d781998a': restorecon: do not set security.restorecon_last on ramfs and tmpfs
-rw-r--r--src/android.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c
index 1b4496d..5608f19 100644
--- a/src/android.c
+++ b/src/android.c
@@ -29,6 +29,8 @@
#include "label_internal.h"
#include <fnmatch.h>
#include <limits.h>
+#include <sys/vfs.h>
+#include <linux/magic.h>
/*
* XXX Where should this configuration file be located?
@@ -1226,6 +1228,7 @@ static int selinux_android_restorecon_common(const char* pathname_orig,
bool issys;
bool setrestoreconlast = true;
struct stat sb;
+ struct statfs sfsb;
FTS *fts;
FTSENT *ftsent;
char *pathname;
@@ -1282,6 +1285,12 @@ static int selinux_android_restorecon_common(const char* pathname_orig,
if (issys)
setrestoreconlast = false;
+ /* Ignore files on in-memory filesystems */
+ if (statfs(pathname, &sfsb) == 0) {
+ if (sfsb.f_type == RAMFS_MAGIC || sfsb.f_type == TMPFS_MAGIC)
+ setrestoreconlast = false;
+ }
+
if (setrestoreconlast) {
size = getxattr(pathname, RESTORECON_LAST, xattr_value, sizeof fc_digest);
if (!force && size == sizeof fc_digest && memcmp(fc_digest, xattr_value, sizeof fc_digest) == 0) {