summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-12-16 14:26:08 -0800
committerBrian Behlendorf <[email protected]>2011-01-28 12:45:19 -0800
commitb3259b6a2ba29595dc5f2df0f6def8c7fc6bcb98 (patch)
tree57c70e929f1dd3ec12243144ea542b51c3dade56 /lib
parent95c73795b001267d6b683b71e8abe51de4b0c938 (diff)
Autoconf selinux support
If libselinux is detected on your system at configure time link against it. This allows us to use a library call to detect if selinux is enabled and if it is to pass the mount option: "context=\"system_u:object_r:file_t:s0" For now this is required because none of the existing selinux policies are aware of the zfs filesystem type. Because of this they do not properly enable xattr based labeling even though zfs supports all of the required hooks. Until distro's add zfs as a known xattr friendly fs type we must use mntpoint labeling. Alternately, end users could modify their existing selinux policy with a little guidance.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.in2
-rw-r--r--lib/libavl/Makefile.in2
-rw-r--r--lib/libefi/Makefile.in2
-rw-r--r--lib/libnvpair/Makefile.in2
-rw-r--r--lib/libspl/Makefile.in2
-rw-r--r--lib/libspl/asm-generic/Makefile.in2
-rw-r--r--lib/libspl/asm-i386/Makefile.in2
-rw-r--r--lib/libspl/asm-x86_64/Makefile.in2
-rw-r--r--lib/libspl/include/Makefile.in2
-rw-r--r--lib/libspl/include/ia32/Makefile.in2
-rw-r--r--lib/libspl/include/ia32/sys/Makefile.in2
-rw-r--r--lib/libspl/include/rpc/Makefile.in2
-rw-r--r--lib/libspl/include/sys/Makefile.in2
-rw-r--r--lib/libspl/include/sys/dktp/Makefile.in2
-rw-r--r--lib/libspl/include/sys/sysevent/Makefile.in2
-rw-r--r--lib/libspl/include/util/Makefile.in2
-rw-r--r--lib/libunicode/Makefile.in2
-rw-r--r--lib/libuutil/Makefile.in2
-rw-r--r--lib/libzfs/Makefile.am2
-rw-r--r--lib/libzfs/Makefile.in4
-rw-r--r--lib/libzfs/libzfs_mount.c9
-rw-r--r--lib/libzpool/Makefile.in2
22 files changed, 51 insertions, 2 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 9749b774a..18ff05229 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -178,6 +179,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in
index 930f8e580..500846a77 100644
--- a/lib/libavl/Makefile.in
+++ b/lib/libavl/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -190,6 +191,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in
index 294cac074..1f4409066 100644
--- a/lib/libefi/Makefile.in
+++ b/lib/libefi/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -190,6 +191,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in
index 8f689d4d8..e1027d51c 100644
--- a/lib/libnvpair/Makefile.in
+++ b/lib/libnvpair/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -191,6 +192,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in
index 6bf147834..385a567c6 100644
--- a/lib/libspl/Makefile.in
+++ b/lib/libspl/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -241,6 +242,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in
index 8b87c314b..162c386ca 100644
--- a/lib/libspl/asm-generic/Makefile.in
+++ b/lib/libspl/asm-generic/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -139,6 +140,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in
index fe9d9cb4f..9a26bb4d4 100644
--- a/lib/libspl/asm-i386/Makefile.in
+++ b/lib/libspl/asm-i386/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -143,6 +144,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in
index 750690300..a00f235b7 100644
--- a/lib/libspl/asm-x86_64/Makefile.in
+++ b/lib/libspl/asm-x86_64/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -143,6 +144,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in
index 1a0a7f8b1..360560052 100644
--- a/lib/libspl/include/Makefile.in
+++ b/lib/libspl/include/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -203,6 +204,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in
index 4b97ee1b4..a9f80cde8 100644
--- a/lib/libspl/include/ia32/Makefile.in
+++ b/lib/libspl/include/ia32/Makefile.in
@@ -65,6 +65,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -178,6 +179,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in
index 1b2fb35ee..fb0fe3f8c 100644
--- a/lib/libspl/include/ia32/sys/Makefile.in
+++ b/lib/libspl/include/ia32/sys/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -165,6 +166,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in
index f5385d9d1..1fd162a47 100644
--- a/lib/libspl/include/rpc/Makefile.in
+++ b/lib/libspl/include/rpc/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -165,6 +166,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in
index 20fdfca14..0746ded39 100644
--- a/lib/libspl/include/sys/Makefile.in
+++ b/lib/libspl/include/sys/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -203,6 +204,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in
index 713aa88b6..499081af2 100644
--- a/lib/libspl/include/sys/dktp/Makefile.in
+++ b/lib/libspl/include/sys/dktp/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -165,6 +166,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in
index 858e38877..0a9c6d186 100644
--- a/lib/libspl/include/sys/sysevent/Makefile.in
+++ b/lib/libspl/include/sys/sysevent/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -165,6 +166,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in
index 1cdbb5740..27aa363f3 100644
--- a/lib/libspl/include/util/Makefile.in
+++ b/lib/libspl/include/util/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -165,6 +166,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in
index 1f431dad3..5daee2b73 100644
--- a/lib/libunicode/Makefile.in
+++ b/lib/libunicode/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -190,6 +191,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in
index e600ba49f..1a28249ae 100644
--- a/lib/libuutil/Makefile.in
+++ b/lib/libuutil/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -192,6 +193,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am
index 70210c35b..de5212234 100644
--- a/lib/libzfs/Makefile.am
+++ b/lib/libzfs/Makefile.am
@@ -6,7 +6,7 @@ DEFAULT_INCLUDES += \
lib_LTLIBRARIES = libzfs.la
-libzfs_la_LDFLAGS = -lm
+libzfs_la_LDFLAGS = -lm $(LIBSELINUX)
libzfs_la_LIBADD = \
$(top_builddir)/lib/libefi/libefi.la \
diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in
index 741f39da4..c8b500466 100644
--- a/lib/libzfs/Makefile.in
+++ b/lib/libzfs/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -197,6 +198,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
@@ -314,7 +316,7 @@ AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing \
-D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\"
lib_LTLIBRARIES = libzfs.la
-libzfs_la_LDFLAGS = -lm
+libzfs_la_LDFLAGS = -lm $(LIBSELINUX)
libzfs_la_LIBADD = \
$(top_builddir)/lib/libefi/libefi.la \
$(top_builddir)/lib/libuutil/libuutil.la
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index 88bd0714e..9950bf967 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -72,6 +72,9 @@
#include <sys/mntent.h>
#include <sys/mount.h>
#include <sys/stat.h>
+#ifdef HAVE_LIBSELINUX
+#include <selinux/selinux.h>
+#endif /* HAVE_LIBSELINUX */
#include <libzfs.h>
@@ -277,6 +280,12 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
flags |= MS_RDONLY;
+#ifdef HAVE_LIBSELINUX
+ if (is_selinux_enabled())
+ (void) strlcat(mntopts, ",context=\"system_u:"
+ "object_r:file_t:s0\"", sizeof (mntopts));
+#endif /* HAVE_LIBSELINUX */
+
if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
return (0);
diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in
index 99ad7199c..421e55cc2 100644
--- a/lib/libzpool/Makefile.in
+++ b/lib/libzpool/Makefile.in
@@ -67,6 +67,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -211,6 +212,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@