summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2016-03-07 15:52:42 -0500
committerPhilip Tricca <flihp@twobit.us>2016-03-17 02:25:04 +0000
commit81c08f019b1edc4fe97a2e2b5cc7687114e99ec8 (patch)
treecf7f362f677c97b39e8b592f6dd274e81c7e15da
parent06d8dac0530674a8eae9b2f030f11c59980b2586 (diff)
downloadmeta-selinux-81c08f019b1edc4fe97a2e2b5cc7687114e99ec8.tar.gz
libselinux: uprev to 2.5 (20160223)
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Philip Tricca <flihp@twobit.us>
-rw-r--r--recipes-security/selinux/libselinux/libselinux-get-pywrap-depends-on-selinux.py.patch31
-rw-r--r--recipes-security/selinux/libselinux/libselinux-make-O_CLOEXEC-optional.patch67
-rw-r--r--recipes-security/selinux/libselinux/libselinux-mount-procfs-before-check.patch74
-rw-r--r--recipes-security/selinux/libselinux_2.5.bb (renamed from recipes-security/selinux/libselinux_2.4.bb)8
4 files changed, 35 insertions, 145 deletions
diff --git a/recipes-security/selinux/libselinux/libselinux-get-pywrap-depends-on-selinux.py.patch b/recipes-security/selinux/libselinux/libselinux-get-pywrap-depends-on-selinux.py.patch
deleted file mode 100644
index 7994be4..0000000
--- a/recipes-security/selinux/libselinux/libselinux-get-pywrap-depends-on-selinux.py.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 187ff834e40519b42caa3fba9f1054491f48ab67 Mon Sep 17 00:00:00 2001
2From: Wenzong Fan <wenzong.fan@windriver.com>
3Date: Tue, 11 Aug 2015 16:21:13 +0800
4Subject: [PATCH] libselinux: get pywrap depends on selinux.py
5
6The selinux.py will be installed as selinux/__init__.py, just make sure
7it has been generated completely while starting "make install-pywrap".
8
9Upstream-Status: Pending
10
11Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
12---
13 src/Makefile | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/src/Makefile b/src/Makefile
17index a4d27f4..624d25b 100644
18--- a/src/Makefile
19+++ b/src/Makefile
20@@ -90,7 +90,7 @@ SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./
21
22 all: $(LIBA) $(LIBSO) $(LIBPC)
23
24-pywrap: all $(SWIGSO) $(AUDIT2WHYSO)
25+pywrap: all $(SWIGFILES) $(AUDIT2WHYSO)
26
27 rubywrap: all $(SWIGRUBYSO)
28
29--
301.9.1
31
diff --git a/recipes-security/selinux/libselinux/libselinux-make-O_CLOEXEC-optional.patch b/recipes-security/selinux/libselinux/libselinux-make-O_CLOEXEC-optional.patch
index 453334e..98d31cc 100644
--- a/recipes-security/selinux/libselinux/libselinux-make-O_CLOEXEC-optional.patch
+++ b/recipes-security/selinux/libselinux/libselinux-make-O_CLOEXEC-optional.patch
@@ -24,13 +24,13 @@ Signed-off-by: Joe MacDonald <joe.macdonald@windriver.com>
24 src/stringrep.c | 8 +++++++- 24 src/stringrep.c | 8 +++++++-
25 4 files changed, 28 insertions(+), 4 deletions(-) 25 4 files changed, 28 insertions(+), 4 deletions(-)
26 26
27diff --git a/src/label_file.c b/src/label_file.c 27Index: libselinux-2.5/src/label_file.c
28index 5f697f3..49bb8df 100644 28===================================================================
29--- a/src/label_file.c 29--- libselinux-2.5.orig/src/label_file.c 2016-02-25 13:10:00.159980383 -0500
30+++ b/src/label_file.c 30+++ libselinux-2.5/src/label_file.c 2016-02-25 13:10:00.155980383 -0500
31@@ -255,7 +255,13 @@ static int load_mmap(struct selabel_handle *rec, const char *path, struct stat * 31@@ -124,7 +124,13 @@
32 if (rc >= sizeof(mmap_path)) 32 return -1;
33 return -1; 33 }
34 34
35- mmapfd = open(mmap_path, O_RDONLY | O_CLOEXEC); 35- mmapfd = open(mmap_path, O_RDONLY | O_CLOEXEC);
36+ mmapfd = open(mmap_path, O_RDONLY 36+ mmapfd = open(mmap_path, O_RDONLY
@@ -43,30 +43,30 @@ index 5f697f3..49bb8df 100644
43 if (mmapfd < 0) 43 if (mmapfd < 0)
44 return -1; 44 return -1;
45 45
46diff --git a/src/procattr.c b/src/procattr.c 46Index: libselinux-2.5/src/procattr.c
47index 6c5b45a..6cfe589 100644 47===================================================================
48--- a/src/procattr.c 48--- libselinux-2.5.orig/src/procattr.c 2016-02-25 13:10:00.159980383 -0500
49+++ b/src/procattr.c 49+++ libselinux-2.5/src/procattr.c 2016-02-25 13:11:58.527980013 -0500
50@@ -86,7 +86,13 @@ static int openattr(pid_t pid, const char *attr, int flags) 50@@ -76,7 +76,13 @@
51 if (rc < 0) 51 rc = asprintf(&path, "/proc/thread-self/attr/%s", attr);
52 return -1; 52 if (rc < 0)
53 53 return -1;
54- fd = open(path, flags | O_CLOEXEC); 54- fd = open(path, flags | O_CLOEXEC);
55+ fd = open(path, flags 55+ fd = open(path, flags
56+#ifdef O_CLOEXEC 56+#ifdef O_CLOEXEC
57+ | O_CLOEXEC 57+ | O_CLOEXEC
58+#else 58+#else
59+#warning O_CLOEXEC undefined on this platform, this may leak file descriptors 59+#warning O_CLOEXEC undefined on this platform, this may leak file descriptors
60+#endif 60+#endif
61+ ); 61+ );
62 free(path); 62 if (fd >= 0 || errno != ENOENT)
63 return fd; 63 goto out;
64 } 64 free(path);
65diff --git a/src/sestatus.c b/src/sestatus.c 65Index: libselinux-2.5/src/sestatus.c
66index ed29dc5..0cb15b6 100644 66===================================================================
67--- a/src/sestatus.c 67--- libselinux-2.5.orig/src/sestatus.c 2016-02-25 13:10:00.159980383 -0500
68+++ b/src/sestatus.c 68+++ libselinux-2.5/src/sestatus.c 2016-02-25 13:10:00.155980383 -0500
69@@ -268,7 +268,13 @@ int selinux_status_open(int fallback) 69@@ -268,7 +268,13 @@
70 return -1; 70 return -1;
71 71
72 snprintf(path, sizeof(path), "%s/status", selinux_mnt); 72 snprintf(path, sizeof(path), "%s/status", selinux_mnt);
@@ -81,11 +81,11 @@ index ed29dc5..0cb15b6 100644
81 if (fd < 0) 81 if (fd < 0)
82 goto error; 82 goto error;
83 83
84diff --git a/src/stringrep.c b/src/stringrep.c 84Index: libselinux-2.5/src/stringrep.c
85index ba75ccd..e6ccfd5 100644 85===================================================================
86--- a/src/stringrep.c 86--- libselinux-2.5.orig/src/stringrep.c 2016-02-25 13:10:00.159980383 -0500
87+++ b/src/stringrep.c 87+++ libselinux-2.5/src/stringrep.c 2016-02-25 13:10:00.155980383 -0500
88@@ -258,7 +258,13 @@ static struct discover_class_node * discover_class(const char *s) 88@@ -105,7 +105,13 @@
89 struct stat m; 89 struct stat m;
90 90
91 snprintf(path, sizeof path, "%s/class/%s/perms/%s", selinux_mnt,s,dentry->d_name); 91 snprintf(path, sizeof path, "%s/class/%s/perms/%s", selinux_mnt,s,dentry->d_name);
@@ -100,6 +100,3 @@ index ba75ccd..e6ccfd5 100644
100 if (fd < 0) 100 if (fd < 0)
101 goto err4; 101 goto err4;
102 102
103--
1041.7.10.4
105
diff --git a/recipes-security/selinux/libselinux/libselinux-mount-procfs-before-check.patch b/recipes-security/selinux/libselinux/libselinux-mount-procfs-before-check.patch
deleted file mode 100644
index dc27aaa..0000000
--- a/recipes-security/selinux/libselinux/libselinux-mount-procfs-before-check.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1commit 9df498884665d79474b79f0f30d1cd67df11bd3e
2Author: Ben Shelton <ben.shelton@ni.com>
3Date: Wed Apr 15 15:56:57 2015 -0500
4
5 libselinux: Mount procfs before checking /proc/filesystems
6
7 In the case where the SELinux security module is not loaded in the
8 kernel and it's early enough in the boot process that /proc has not yet
9 been mounted, selinuxfs_exists() will incorrectly return 1, and
10 selinux_init_load_policy() will print a message like this to the
11 console:
12
13 Mount failed for selinuxfs on /sys/fs/selinux: No such file or directory
14
15 To fix this, mount the procfs before attempting to open
16 /proc/filesystems, and unmount it when done if it was initially not
17 mounted. This is the same thing that selinux_init_load_policy() does
18 when reading /proc/cmdline.
19
20 Signed-off-by: Ben Shelton <ben.shelton@ni.com>
21
22Upstream-Status: Accepted
23
24diff --git a/src/init.c b/src/init.c
25index 6d1ef33..179e0d0 100644
26--- a/src/init.c
27+++ b/src/init.c
28@@ -11,6 +11,7 @@
29 #include <sys/vfs.h>
30 #include <stdint.h>
31 #include <limits.h>
32+#include <sys/mount.h>
33
34 #include "dso.h"
35 #include "policy.h"
36@@ -54,15 +55,20 @@ static int verify_selinuxmnt(const char *mnt)
37
38 int selinuxfs_exists(void)
39 {
40- int exists = 0;
41+ int exists = 0, mnt_rc = 0;
42 FILE *fp = NULL;
43 char *buf = NULL;
44 size_t len;
45 ssize_t num;
46
47+ mnt_rc = mount("proc", "/proc", "proc", 0, 0);
48+
49 fp = fopen("/proc/filesystems", "r");
50- if (!fp)
51- return 1; /* Fail as if it exists */
52+ if (!fp) {
53+ exists = 1; /* Fail as if it exists */
54+ goto out;
55+ }
56+
57 __fsetlocking(fp, FSETLOCKING_BYCALLER);
58
59 num = getline(&buf, &len, fp);
60@@ -76,6 +82,14 @@ int selinuxfs_exists(void)
61
62 free(buf);
63 fclose(fp);
64+
65+out:
66+#ifndef MNT_DETACH
67+#define MNT_DETACH 2
68+#endif
69+ if (mnt_rc == 0)
70+ umount2("/proc", MNT_DETACH);
71+
72 return exists;
73 }
74 hidden_def(selinuxfs_exists)
diff --git a/recipes-security/selinux/libselinux_2.4.bb b/recipes-security/selinux/libselinux_2.5.bb
index 64fa81d..a744b2f 100644
--- a/recipes-security/selinux/libselinux_2.4.bb
+++ b/recipes-security/selinux/libselinux_2.5.bb
@@ -1,17 +1,15 @@
1include selinux_20150202.inc 1include selinux_20160223.inc
2include ${BPN}.inc 2include ${BPN}.inc
3 3
4LIC_FILES_CHKSUM = "file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0"
5 5
6SRC_URI[md5sum] = "d19af2a367a81fb00bedc1b381694995" 6SRC_URI[md5sum] = "d1399f5c2fd2fbe0e9603d5143b30367"
7SRC_URI[sha256sum] = "46043091f4c5ba4f43e8d3715f30d665a2d571c9126c1f03945c9ea4ed380f7b" 7SRC_URI[sha256sum] = "94c9e97706280bedcc288f784f67f2b9d3d6136c192b2c9f812115edba58514f"
8 8
9SRC_URI += "\ 9SRC_URI += "\
10 file://libselinux-drop-Wno-unused-but-set-variable.patch \ 10 file://libselinux-drop-Wno-unused-but-set-variable.patch \
11 file://libselinux-make-O_CLOEXEC-optional.patch \ 11 file://libselinux-make-O_CLOEXEC-optional.patch \
12 file://libselinux-make-SOCK_CLOEXEC-optional.patch \ 12 file://libselinux-make-SOCK_CLOEXEC-optional.patch \
13 file://libselinux-define-FD_CLOEXEC-as-necessary.patch \ 13 file://libselinux-define-FD_CLOEXEC-as-necessary.patch \
14 file://libselinux-get-pywrap-depends-on-selinux.py.patch \
15 file://0001-src-Makefile-fix-includedir-in-libselinux.pc.patch \ 14 file://0001-src-Makefile-fix-includedir-in-libselinux.pc.patch \
16 file://libselinux-mount-procfs-before-check.patch \
17 " 15 "