From bd4c4a629f08f042f05dcb99ac55180dbdb511f6 Mon Sep 17 00:00:00 2001 From: Jason Zaman Date: Thu, 2 Jun 2016 16:04:35 +0800 Subject: mount tmpfs with correct selinux labels Signed-off-by: Jason Zaman --- src/ck-sysdeps-linux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ck-sysdeps-linux.c b/src/ck-sysdeps-linux.c index e4f6e86..1331cca 100644 --- a/src/ck-sysdeps-linux.c +++ b/src/ck-sysdeps-linux.c @@ -998,14 +998,22 @@ ck_make_tmpfs (guint uid, guint gid, const gchar *dest) { #ifdef HAVE_SYS_MOUNT_H gchar *opts; + gchar *context; int result; TRACE (); - opts = g_strdup_printf ("mode=0700,uid=%d", uid); + context = ck_selinux_lookup_context(dest); + if (context) { + opts = g_strdup_printf ("mode=0700,uid=%d,rootcontext=%s", uid, context); + } else { + opts = g_strdup_printf ("mode=0700,uid=%d", uid); + } + g_debug ("mounting tmpfs. uid=%d, gid=%d, dest=%s, opts=%s", uid, gid, dest, opts); result = mount("none", dest, "tmpfs", 0, opts); + g_free (context); g_free (opts); if (result == 0) { -- cgit v1.2.3