Skip to contentSkip to conversation

*** Update selinux libraries ***

PATCH Superseded Adam Duskett 2 participants 12 messages Jun 26, 2016

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 *** Update selinux libraries ***

Many of the packages in buildroot pertaining to selinux are woefully out of date. This patch series focuses on bringing these packages up to date with the current releases.

In addition, it also adds host compilation to libcap-ng and audit in anticipation for the new package refpolicy and policycoreutils which will require host-audit (and host-audit requires host-libcap-ng).

Adam Duskett (1):
[1/8,v5] libcap-ng: Allow host compilation. [2/8,v5] audit: bump to version 2.6
[3/8,v5] audit: Add the ability to compile as a host package. [4/8,v5] libsemanage: bump to version 2.5
[5/8,v5] checkpolicy: bump to version 2.5
[6/8,v5] libselinux: bump to version 2.5
[7/8,v5] libsepol: bump to version 2.5
[8/8,v5] setools: fix build with latest selinux libraries.

 package/audit/audit.hash | 2 +-
 package/audit/audit.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v5 1/8 libcap-ng: Allow host compilation.

host-libcap-ng is needed for host-audit.
host-audit is needed for host-libsemanage. host-libsemanage is needed for upcomming policycoreutils package. host-policycoreutils is needed for the upcomming refpolicy package.

---

Changes v2 -> v5:
- Patch series version bump.

Changes v1 -> v2:
- Re-ordered patch set.

 package/libcap-ng/libcap-ng.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libcap-ng/libcap-ng.mk +4 -0
index d78f5dc..543cbe6 100644
@@ -13,4 +13,8 @@ LIBCAP_NG_INSTALL_STAGING = YES
 LIBCAP_NG_CONF_ENV = ac_cv_prog_swig_found=no
 LIBCAP_NG_CONF_OPTS = --without-python
 
+HOST_LIBCAP_NG_CONF_ENV = ac_cv_prog_swig_found=no
+HOST_LIBCAP_NG_CONF_OPTS = --without-python
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
2.7.4
#2 lore raw

PATCH v5 2/8 audit: bump to version 2.6

In reply to Adam Duskett

---
Changes v4 -> v5:
- Patch series version bump.

Changes v3 -> v4:
- Updated to 2.6 instead of 2.5.2

Changes v2 -> v3:
- Split patch into two patches. One for a version bump, the second for the ability to build as a host package.

Changes v1 -> v2:
- Version bump and the ability to build as a host package as a single patch.

 package/audit/audit.hash | 2 +-
 package/audit/audit.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/audit/audit.hash +1 -1
index f234fdb..3712f43 100644
@@ -1,2 +1,2 @@
 #Locally computed
-sha256	25f57f465f3230d7b1166b615ffd6748818a3dc225d0e8b396c5b2e951674e23	audit-2.4.4.tar.gz
+sha256	b04dbc16dd877c32c3a05a512ed825abfbd5fabd5d3ecca6b4fcbd6bbac5f94e	audit-2.6.tar.gz
package/audit/audit.mk +1 -1
index 1fbc623..937244d 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-AUDIT_VERSION = 2.4.4
+AUDIT_VERSION = 2.6
 AUDIT_SITE = http://people.redhat.com/sgrubb/audit
 AUDIT_LICENSE = GPLv2
 AUDIT_LICENSE_FILES = COPYING
Signature · 1 line
2.7.4
#3 lore raw

PATCH v5 3/8 audit: Add the ability to compile as a host package.

In reply to Adam Duskett

Along with the aforementioned version bump to 2.6, this will allow the audit package to compile as a host package. This is needed for the upcomming policycoreutils package which is required for the upcomming refpolicy package.

---
Changes v2 -> v5:
- Patch series version bump.

Changes v1 -> v2:
- Changed libcap-ng to host-libcap-ng

 package/audit/audit.mk | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
package/audit/audit.mk +21 -0
index 9589c06..e5c55ff 100644
@@ -56,4 +56,25 @@ define AUDIT_INSTALL_CLEANUP
 endef
 AUDIT_POST_INSTALL_TARGET_HOOKS += AUDIT_INSTALL_CLEANUP
 
+HOST_AUDIT_CONF_OPTS = --without-python --without-python3 --disable-zos-remote
+ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
+HOST_AUDIT_DEPENDENCIES += host-libcap-ng
+HOST_AUDIT_CONF_OPTS += --with-libcap-ng=yes
+else
+HOST_AUDIT_CONF_OPTS += --with-libcap-ng=no
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+HOST_AUDIT_CONF_OPTS += --enable-systemd
+else
+HOST_AUDIT_CONF_OPTS += --disable-systemd
+endif
+
+define AUDIT_INSTALL_CLEANUP
+	$(RM) -rf $(HOST_DIR)/etc/rc.d
+	$(RM) -rf $(HOST_DIR)/etc/sysconfig
+endef
+
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
2.7.4
#5 lore raw

PATCH v5 4/8 libsemanage: bump to version 2.5

In reply to Adam Duskett

In addition to bumping the version to 2.5, added a check in the make file to see if BR2_PACKAGE_POLICYCOREUTILS is selected. If it is host-audit is added as a dependency.

(Note that policycoreutils is not yet available, but is being worked on by another contributor.)

The 0001-execption-lib-path-fix.patch is also no longer needed, as the new version of libsemanage includes the fix provided by the patch. As such, the patch was removed, and 0002 was renamed to 0001.

---
Changes v3 -> v5:
- Patch series version bump.

Changes v2 -> v3:
- Added better explination as to why host-audit is added.

Changes v1 -> v2:
- Reverted changes to the select.
- Added explination as to why a patch was removed.

 package/libsemanage/0001-execption-lib-path-fix.patch      | 14 --------------
 ...in-issue.patch => 0001-workaround-blackfin-issue.patch} |  5 +++--
 package/libsemanage/libsemanage.hash                       |  2 +-
 package/libsemanage/libsemanage.mk                         | 13 +++++++++----
 4 files changed, 13 insertions(+), 21 deletions(-)
 delete mode 100644 package/libsemanage/0001-execption-lib-path-fix.patch
 rename package/libsemanage/{0002-workaround-blackfin-issue.patch => 0001-workaround-blackfin-issue.patch} (89%)
package/libsemanage/0001-execption-lib-path-fix.patch deleted +0 -14
deleted file mode 100644
index cbcbea5..0000000
@@ -1,14 +0,0 @@
-Patch to correct a missing header file issue.
-
-Signed-off-by Clayton Shotwell <[email protected]>
-
---- a/src/exception.sh	2011-12-21 11:46:04.000000000 -0600
-+++ b/src/exception.sh	2012-08-27 11:29:58.000000000 -0500
-@@ -9,6 +9,6 @@
- }
- "
- }
--gcc -x c -c - -aux-info temp.aux < ../include/semanage/semanage.h
-+gcc -x c -c - -aux-info temp.aux -I../include < ../include/semanage/semanage.h
- for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
- rm -f -- temp.aux -.o
package/libsemanage/0001-workaround-blackfin-issue.patch renamed from package/libsemanage/0002-workaround-blackfin-issue.patch +3 -2
similarity index 89%
rename from package/libsemanage/0002-workaround-blackfin-issue.patch
rename to package/libsemanage/0001-workaround-blackfin-issue.patch
index 5d00c69..7ce9606 100644
@@ -8,14 +8,15 @@ symbols are visible in the final DSO, which is not a problem for
 proper execution, it just isn't as clean.
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
 
 Index: b/src/dso.h
 ===================================================================
 --- a/src/dso.h
 +++ b/src/dso.h
 @@ -1,7 +1,7 @@
- #ifndef _SELINUX_DSO_H
- #define _SELINUX_DSO_H	1
+ #ifndef _SEPOL_DSO_H
+ #define _SEPOL_DSO_H	1
  
 -#ifdef SHARED
 +#if defined(SHARED) && !defined(__bfin__)
package/libsemanage/libsemanage.hash +1 -1
index d4204d1..69f7c8d 100644
@@ -1,2 +1,2 @@
 # Locally computed
-sha256 de2e8077245581e94576276f54e80a53c23c28d6961d2dfbe2f004eaba452e91 libsemanage-2.1.10.tar.gz
+sha256 46e2f36254369b6e91d1eea0460c262b139361b055a3a67d3ceea2d8ef72e006 libsemanage-2.5.tar.gz
package/libsemanage/libsemanage.mk +9 -4
index 197c14e..562ae1a 100644
@@ -4,11 +4,11 @@
 #
 ################################################################################
 
-LIBSEMANAGE_VERSION = 2.1.10
-LIBSEMANAGE_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20130423
+LIBSEMANAGE_VERSION = 2.5
+LIBSEMANAGE_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223
 LIBSEMANAGE_LICENSE = LGPLv2.1+
 LIBSEMANAGE_LICENSE_FILES = COPYING
-LIBSEMANAGE_DEPENDENCIES = host-bison host-flex libselinux ustr bzip2
+LIBSEMANAGE_DEPENDENCIES = host-bison host-flex audit libselinux ustr bzip2
 LIBSEMANAGE_INSTALL_STAGING = YES
 
 LIBSEMANAGE_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS)
@@ -27,8 +27,13 @@ define LIBSEMANAGE_INSTALL_TARGET_CMDS
 	$(MAKE) -C $(@D) $(LIBSEMANAGE_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
 endef
 
-HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-libsepol host-libselinux \
+HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-audit host-libsepol host-libselinux \
 				host-ustr host-bzip2 host-swig
+
+ifeq ($(BR2_PACKAGE_POLICYCOREUTILS),y)
+HOST_LIBSEMANAGE_DEPENDENCIES += host-audit
+endif
+
 HOST_LIBSEMANAGE_MAKE_OPTS += $(HOST_CONFIGURE_OPTS) \
 	SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH v5 5/8 checkpolicy: bump to version 2.5

In reply to Adam Duskett

---
Changes v1 - v5:
- Patch series version bump.

 package/checkpolicy/checkpolicy.hash | 2 +-
 package/checkpolicy/checkpolicy.mk   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
package/checkpolicy/checkpolicy.hash +1 -1
index 32b5ff6..bc5199c 100644
@@ -1,2 +1,2 @@
 # https://github.com/SELinuxProject/selinux/wiki/Releases
-sha256 e6a0ac539b74859b4262b317eb90d9914deb15e7aa509659f47724d50fe2ecc6  checkpolicy-2.1.12.tar.gz
+sha256 33af9f3eb19135a7e6536ecd3fbb9686323000016cd51eb88346346ed7546001  checkpolicy-2.5.tar.gz
package/checkpolicy/checkpolicy.mk +2 -2
index 4b7b2f3..f1b76d0 100644
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-CHECKPOLICY_VERSION = 2.1.12
-CHECKPOLICY_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20130423
+CHECKPOLICY_VERSION = 2.5
+CHECKPOLICY_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223
 CHECKPOLICY_LICENSE = GPLv2
 CHECKPOLICY_LICENSE_FILES = COPYING
 
Signature · 1 line
2.7.4
#8 lore raw

PATCH v5 6/8 libselinux: bump to version 2.5

In reply to Adam Duskett

In addition, if a user is using glibc 2.22, the default CFLAG D_FILE_OFFSET_BITS=64 will cause a compile error. This flag is now removed from the CFLAGS in the make file to ensure that toolchains compiled against glibc 2.22 will build the new version of the package properly.

---
Changes v3 - v5:
- Patch series version bump.

Changes v2 -> v3:
- Changed logic to use filter-out instead of specifying cflags manually.

Changes v1 -> v2:
- Reverted depends on in the config file.
- Added manual cflags.

 package/libselinux/libselinux.hash | 2 +-
 package/libselinux/libselinux.mk   | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
package/libselinux/libselinux.hash +1 -1
index 861c327..a4c3440 100644
@@ -1,2 +1,2 @@
 # Locally computed
-sha256 57aad47c06b7ec18a76e8d9870539277a84cb40109cfdcf70ed3260bdb04447a libselinux-2.1.13.tar.gz
+sha256 94c9e97706280bedcc288f784f67f2b9d3d6136c192b2c9f812115edba58514f libselinux-2.5.tar.gz
package/libselinux/libselinux.mk +4 -2
index d4b96c4..928c5e0 100644
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-LIBSELINUX_VERSION = 2.1.13
-LIBSELINUX_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20130423
+LIBSELINUX_VERSION = 2.5
+LIBSELINUX_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223
 LIBSELINUX_LICENSE = Public Domain
 LIBSELINUX_LICENSE_FILES = LICENSE
 
@@ -13,8 +13,10 @@ LIBSELINUX_DEPENDENCIES = libsepol pcre
 
 LIBSELINUX_INSTALL_STAGING = YES
 
+# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22.
 LIBSELINUX_MAKE_OPTS = \
 	$(TARGET_CONFIGURE_OPTS) \
+	CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
 	LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
 	ARCH=$(KERNEL_ARCH)
 
Signature · 1 line
2.7.4
#9 lore raw

PATCH v5 7/8 libsepol: bump to version 2.5

In reply to Adam Duskett

---
Changes v3 - v5:
- Patch series version bump.

Changes v2 - v3:
- Added SOB to included patch files.

Changes v1 - v2:
- Fixed broken (by me) support static-only patch that caused build
errors

 package/libsepol/0001-support-static-only.patch    | 26 +++++++++++-----------
 .../libsepol/0002-workaround-blackfin-issue.patch  |  8 ++++---
 package/libsepol/libsepol.hash                     |  2 +-
 package/libsepol/libsepol.mk                       |  4 ++--
 4 files changed, 21 insertions(+), 19 deletions(-)
package/libsepol/0001-support-static-only.patch +13 -13
index b974680..3e9a84f 100644
@@ -7,37 +7,37 @@ libraries. It allows to support cases where the target architecture
 does not have support for shared libraries.
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
 
 Index: b/src/Makefile
 ===================================================================
+
+diff --git a/src/Makefile b/src/Makefile
+index db6c2ba..0006285 100644
 --- a/src/Makefile
 +++ b/src/Makefile
-@@ -17,7 +17,12 @@
- CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute
- override CFLAGS += -I. -I../include -D_GNU_SOURCE
+@@ -30,8 +30,12 @@ LOBJS += $(sort $(patsubst %.c,%.lo,$(wildcard $(CILDIR)/src/*.c) $(CIL_GENERATE
+ override CFLAGS += -I$(CILDIR)/include
+ endif
  
--all: $(LIBA) $(LIBSO) $(LIBPC)
 +ALL_TARGETS = $(LIBA) $(LIBPC)
 +ifeq ($(STATIC),)
 +ALL_TARGETS += $(LIBSO)
 +endif
-+
+
+-all: $(LIBA) $(LIBSO) $(LIBPC)
 +all: $(ALL_TARGETS)
  
+
  $(LIBA):  $(OBJS)
- 	$(AR) rcs $@ $^
-@@ -39,11 +44,13 @@
- install: all
- 	test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
- 	install -m 644 $(LIBA) $(LIBDIR)
--	test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
--	install -m 755 $(LIBSO) $(SHLIBDIR)
+@@ -70,7 +74,11 @@ install: all
+ 	install -m 755 $(LIBSO) $(SHLIBDIR)
  	test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
  	install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
 +ifeq ($(STATIC),)
 +	test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
 +	install -m 755 $(LIBSO) $(SHLIBDIR)
- 	cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
+ 	ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
 +endif
  
  relabel:
package/libsepol/0002-workaround-blackfin-issue.patch +5 -3
index 5d00c69..3c3bd48 100644
@@ -8,17 +8,19 @@ symbols are visible in the final DSO, which is not a problem for
 proper execution, it just isn't as clean.
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
 
 Index: b/src/dso.h
 ===================================================================
 --- a/src/dso.h
 +++ b/src/dso.h
-@@ -1,7 +1,7 @@
- #ifndef _SELINUX_DSO_H
- #define _SELINUX_DSO_H	1
+@@ -5,7 +5,7 @@
+     #define DISABLE_SYMVER 1
+ #endif
  
 -#ifdef SHARED
 +#if defined(SHARED) && !defined(__bfin__)
  # define hidden __attribute__ ((visibility ("hidden")))
  # define hidden_proto(fct) __hidden_proto (fct, fct##_internal)
  # define __hidden_proto(fct, internal)	\
+
package/libsepol/libsepol.hash +1 -1
index df5dabd..266ce43 100644
@@ -1,2 +1,2 @@
 # From https://github.com/SELinuxProject/selinux/wiki/Releases
-sha256	290d17f583635a4a5d8a2141511272adf0571c4205cdea38b5a68df20d58a70b  libsepol-2.1.9.tar.gz
+sha256 2bdeec56d0a08b082b93b40703b4b3329cc5562152f7254d8f6ef6b56afe850a  libsepol-2.5.tar.gz
package/libsepol/libsepol.mk +2 -2
index 1e709c6..93896cf 100644
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-LIBSEPOL_VERSION = 2.1.9
-LIBSEPOL_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20130423
+LIBSEPOL_VERSION = 2.5
+LIBSEPOL_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223
 LIBSEPOL_LICENSE = LGPLv2.1+
 LIBSEPOL_LICENSE_FILES = COPYING
 
Signature · 1 line
2.7.4
#10 lore raw

PATCH v5 8/8 setools: fix build with latest selinux libraries.

In reply to Adam Duskett

Setools 3.3.8 won't cleanly compile against newer versions of the new selinux libraries. This patch fixes these errors.

---
Changes v2 - v5:
- Patch series version bump.

Changes v1 -> v2:
- Added subject, commit log, and SoB-line to 0003 patch.

 .../0003-fix-build-with-latest-selinux-libs.patch  | 89 ++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 package/setools/0003-fix-build-with-latest-selinux-libs.patch
package/setools/0003-fix-build-with-latest-selinux-libs.patch new file +89 -0
new file mode 100644
index 0000000..78203c8
@@ -0,0 +1,89 @@
+Fix compile errors against newer versions of selinux libraries.
+Credit to: Joe MacDonald <[email protected]>
+URL: https://github.com/flihp/meta-selinux/commit/e09eaef7a9acb552a4a5e1f90117154ae06b6fda
+
+Signed-off-by: Adam Duskett <[email protected]>
+
+diff --git a/libqpol/src/policy_define.c b/libqpol/src/policy_define.c
+index fad6b60..231962f 100644
+--- a/libqpol/src/policy_define.c
++++ b/libqpol/src/policy_define.c
+@@ -1449,7 +1449,7 @@ int define_compute_type_helper(int which, avrule_t ** rule)
+ 				return -1;
+ 			}
+ 			class_perm_node_init(perm);
+-			perm->class = i + 1;
++			perm->tclass = i + 1;
+ 			perm->data = datum->s.value;
+ 			perm->next = avrule->perms;
+ 			avrule->perms = perm;
+@@ -1699,7 +1699,7 @@ int define_te_avtab_helper(int which, avrule_t ** rule)
+ 			goto out;
+ 		}
+ 		class_perm_node_init(cur_perms);
+-		cur_perms->class = i + 1;
++		cur_perms->tclass = i + 1;
+ 		if (!perms)
+ 			perms = cur_perms;
+ 		if (tail)
+diff --git a/libqpol/src/policy_extend.c b/libqpol/src/policy_extend.c
+index 5325a87..1417271 100644
+--- a/libqpol/src/policy_extend.c
++++ b/libqpol/src/policy_extend.c
+@@ -843,7 +843,7 @@ static int qpol_syn_rule_table_insert_sepol_avrule(qpol_policy_t * policy, qpol_
+ 			for (class_node = rule->perms; class_node; class_node = class_node->next) {
+ 				key.rule_type = rule->specified;
+ 				key.source_val = key.target_val = i + 1;
+-				key.class_val = class_node->class;
++				key.class_val = class_node->tclass;
+ 				key.cond = cond;
+ 				if (qpol_syn_rule_table_insert_entry(policy, table, &key, new_rule))
+ 					goto err;
+@@ -856,7 +856,7 @@ static int qpol_syn_rule_table_insert_sepol_avrule(qpol_policy_t * policy, qpol_
+ 				key.rule_type = rule->specified;
+ 				key.source_val = i + 1;
+ 				key.target_val = j + 1;
+-				key.class_val = class_node->class;
++				key.class_val = class_node->tclass;
+ 				key.cond = cond;
+ 				if (qpol_syn_rule_table_insert_entry(policy, table, &key, new_rule))
+ 					goto err;
+diff --git a/libqpol/src/syn_rule_query.c b/libqpol/src/syn_rule_query.c
+index 3e63204..d7578f1 100644
+--- a/libqpol/src/syn_rule_query.c
++++ b/libqpol/src/syn_rule_query.c
+@@ -67,7 +67,7 @@ static void *syn_rule_class_state_get_cur(const qpol_iterator_t * iter)
+ 		return NULL;
+ 	}
+
+-	return db->class_val_to_struct[srcs->cur->class - 1];
++	return db->class_val_to_struct[srcs->cur->tclass - 1];
+ }
+
+ static int syn_rule_class_state_next(qpol_iterator_t * iter)
+@@ -465,10 +465,10 @@ int qpol_syn_avrule_get_perm_iter(const qpol_policy_t * policy, const qpol_syn_a
+ 	}
+
+ 	for (node = internal_rule->perms; node; node = node->next) {
+-		for (i = 0; i < db->class_val_to_struct[node->class - 1]->permissions.nprim; i++) {
++		for (i = 0; i < db->class_val_to_struct[node->tclass - 1]->permissions.nprim; i++) {
+ 			if (!(node->data & (1 << i)))
+ 				continue;
+-			tmp = sepol_av_to_string(db, node->class, (sepol_access_vector_t) (1 << i));
++			tmp = sepol_av_to_string(db, node->tclass, (sepol_access_vector_t) (1 << i));
+ 			if (tmp) {
+ 				tmp++; /* remove prepended space */
+ 				for (cur = 0; cur < perm_list_sz; cur++)
+diff --git a/secmds/replcon.cc b/secmds/replcon.cc
+index 34f7c1a..307c39f 100644
+--- a/secmds/replcon.cc
++++ b/secmds/replcon.cc
+@@ -60,7 +60,7 @@ static struct option const longopts[] = {
+ 	{NULL, 0, NULL, 0}
+ };
+
+-extern int lsetfilecon_raw(const char *, security_context_t) __attribute__ ((weak));
++extern int lsetfilecon_raw(const char *, const char *) __attribute__ ((weak));
+
+ /**
+  * As that setools must work with older libselinux versions that may
Signature · 1 line
2.7.4
#4 lore raw

PATCH v5 3/8 audit: Add the ability to compile as a host package.

In reply to Adam Duskett

Hello,

package/audit/audit.mk define AUDIT_INSTALL_CLEANUP · line 61

Quoted 3 lines · Adam Duskett
package/audit/audit.mk +3 -0
+HOST_AUDIT_CONF_OPTS = --without-python --without-python3 --disable-zos-remote
+ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
+HOST_AUDIT_DEPENDENCIES += host-libcap-ng

This is not good. BR2_PACKAGE_LIBCAP_NG indicates whether the *target* version of libcap-ng is enabled or not. It should *not* have any implication on whether libcap-ng is used in *host* packages.

For host packages, it's pretty simple: include a dependency if it's needed, do not include the dependency if it's not needed.

package/audit/audit.mk define AUDIT_INSTALL_CLEANUP · line 67

Quoted 6 lines
package/audit/audit.mk +6 -0
+HOST_AUDIT_CONF_OPTS += --with-libcap-ng=yes
+else
+HOST_AUDIT_CONF_OPTS += --with-libcap-ng=no
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)

Same here. The fact that systemd is used on the target (which is what BR2_INIT_SYSTEMD indicates) has nothing to do with using systemd for the host variant of audit.

package/audit/audit.mk define AUDIT_INSTALL_CLEANUP · line 76

Quoted 4 lines
package/audit/audit.mk +4 -0
+define AUDIT_INSTALL_CLEANUP
+	$(RM) -rf $(HOST_DIR)/etc/rc.d
+	$(RM) -rf $(HOST_DIR)/etc/sysconfig
+endef

This block is a piece of dead code, as it is never used anywhere. Moreover, it is not useful: we generally don't bother cleaning up things installed in $(HOST_DIR) since disk space on the build machine is not a scarce resource.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+

Only one empty line before the autotools-package macro call.

Quoted 2 lines

$(eval $(autotools-package))
+$(eval $(host-autotools-package))

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH v5 4/8 libsemanage: bump to version 2.5

In reply to Adam Duskett

Hello,

Quoted 3 lines · Adam Duskett

In addition to bumping the version to 2.5, added a check in the make file to see if BR2_PACKAGE_POLICYCOREUTILS is selected. If it is host-audit is added as a dependency.

Please don't do this. The policycoreutils package doesn't exist in Buildroot, so BR2_PACKAGE_POLICYCOREUTILS doesn't exist. For this reason, your patch cannot be merged.

Quoted 2 lines

(Note that policycoreutils is not yet available, but is being worked on by another contributor.)

Please either take over the submission of the policycoreutils package (I doubt the other contributor will continue to work on it), or drop the policycoreutils-related part of this patch.

package/libsemanage/libsemanage.mk line 11

Quoted 8 lines
package/libsemanage/libsemanage.mk +3 -3
-LIBSEMANAGE_VERSION = 2.1.10
-LIBSEMANAGE_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20130423
+LIBSEMANAGE_VERSION = 2.5
+LIBSEMANAGE_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223
 LIBSEMANAGE_LICENSE = LGPLv2.1+
 LIBSEMANAGE_LICENSE_FILES = COPYING
-LIBSEMANAGE_DEPENDENCIES = host-bison host-flex libselinux ustr bzip2
+LIBSEMANAGE_DEPENDENCIES = host-bison host-flex audit libselinux ustr bzip2

So audit is now a mandatory dependency ?

package/libsemanage/libsemanage.mk define LIBSEMANAGE_INSTALL_TARGET_CMDS · line 34

Quoted 13 lines

LIBSEMANAGE_INSTALL_STAGING = YES

LIBSEMANAGE_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS)

package/libsemanage/libsemanage.mk +4 -1
@@ -27,8 +27,13 @@ define LIBSEMANAGE_INSTALL_TARGET_CMDS
 	$(MAKE) -C $(@D) $(LIBSEMANAGE_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
 endef
 
-HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-libsepol host-libselinux \
+HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-audit host-libsepol host-libselinux \
 				host-ustr host-bzip2 host-swig
+
+ifeq ($(BR2_PACKAGE_POLICYCOREUTILS),y)
+HOST_LIBSEMANAGE_DEPENDENCIES += host-audit

This is useless. You are already adding host-audit as a mandatory dependency of host-libsemanage two lines before.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#11 lore raw

PATCH v5 8/8 setools: fix build with latest selinux libraries.

In reply to Adam Duskett

Hello,

package/setools/0003-fix-build-with-latest-selinux-libs.patch line 5

Quoted 11 lines · Adam Duskett
package/setools/0003-fix-build-with-latest-selinux-libs.patch new file +5 -0
new file mode 100644
index 0000000..78203c8
@@ -0,0 +1,89 @@
+Fix compile errors against newer versions of selinux libraries.
+Credit to: Joe MacDonald <[email protected]>
+URL: https://github.com/flihp/meta-selinux/commit/e09eaef7a9acb552a4a5e1f90117154ae06b6fda
+
+Signed-off-by: Adam Duskett <[email protected]>

It would be nicer to copy the setools-Update-for-2015-02-02-Userspace-release.patch file as-is (especially its description and the fact that it's a Git-formatted patch) and just add your SoB line at the end of the patch description.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com