aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2017-09-15 16:12:49 -0500
committerMark Hatle <mark.hatle@windriver.com>2017-09-15 16:12:49 -0500
commitd855c624f32c5e599bf27e06cb8f5b25b3aae12d (patch)
tree77b1ddf7dafc9b0e6a6365a13bef398103b63cb1
parent907e373e4059870231360aabf9d9651d318968d9 (diff)
downloadmeta-selinux-rocko.tar.gz
meta-selinux-rocko.tar.bz2
meta-selinux-rocko.zip
setools: Fix build failures on 64-bit machinesrocko
Bring in a patch from https://github.com/vorlonofportland/setools, commit id 790d7a538f515d27d2390f1ef56c9871b107a346. Fixes an issue where setools fails with: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=] snprintf(buff, 9, "@ttr%04zd", i + 1); Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch47
-rw-r--r--recipes-security/setools/setools_4.1.1.bb1
2 files changed, 48 insertions, 0 deletions
diff --git a/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch b/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch
new file mode 100644
index 0000000..d0faba8
--- /dev/null
+++ b/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch
@@ -0,0 +1,47 @@
+From 790d7a538f515d27d2390f1ef56c9871b107a346 Mon Sep 17 00:00:00 2001
+From: Steve Langasek <steve.langasek@canonical.com>
+Date: Sun, 27 Aug 2017 21:28:40 -0700
+Subject: [PATCH] Fix build failure with GCC 7 due to possible truncation of
+ snprintf output
+
+setools fails to build under GCC7 -Wformat -Werror with the following error:
+
+x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-sign-compare -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ilibqpol -Ilibqpol/include -I/usr/include/python3.6m -c libqpol/policy_extend.c -o build/temp.linux-amd64-3.6/libqpol/policy_extend.o -Werror -Wextra -Waggregate-return -Wfloat-equal -Wformat -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-include-dirs -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wunknown-pragmas -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-qual -Wno-shadow -Wno-unreachable-code -fno-exceptions
+libqpol/policy_extend.c: In function 'policy_extend':
+libqpol/policy_extend.c:161:27: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=]
+ snprintf(buff, 9, "@ttr%04zd", i + 1);
+ ^~~~~
+libqpol/policy_extend.c:161:22: note: directive argument in the range [1, 4294967295]
+ snprintf(buff, 9, "@ttr%04zd", i + 1);
+ ^~~~~~~~~~~
+
+Exceeding 10,000 attributes is necessarily going to result in collisions
+inserting into the hash table given this naming scheme, and we already error
+out on the first collision; but there will be holes since types are not
+handled the same as attributes. Short of making backwards-incompatible
+changes to the entry names, this is probably the best way to fix this build
+failure while reducing the chances of a hash collision in the unlikely event
+that the hashtable is (nearly) full.
+
+Closes: https://github.com/TresysTechnology/setools/issues/174
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+---
+ libqpol/policy_extend.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libqpol/policy_extend.c b/libqpol/policy_extend.c
+index 742819b..70e8f7c 100644
+--- a/libqpol/policy_extend.c
++++ b/libqpol/policy_extend.c
+@@ -158,7 +158,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
+ * with this attribute */
+ /* Does not exist */
+ if (db->p_type_val_to_name[i] == NULL){
+- snprintf(buff, 9, "@ttr%04zd", i + 1);
++ snprintf(buff, 9, "@ttr%04zd", (i + 1) % 10000);
+ tmp_name = strdup(buff);
+ if (!tmp_name) {
+ error = errno;
+--
+1.8.3.1
+
diff --git a/recipes-security/setools/setools_4.1.1.bb b/recipes-security/setools/setools_4.1.1.bb
index 1f78bab..5b6d47d 100644
--- a/recipes-security/setools/setools_4.1.1.bb
+++ b/recipes-security/setools/setools_4.1.1.bb
@@ -11,6 +11,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
SRC_URI = "https://github.com/TresysTechnology/setools/archive/${PV}.tar.gz;downloadfilename=setools-${PV}.tar.gz \
file://setools4-fixes-for-cross-compiling.patch \
file://setools4-fix-cross-compiling-errors-for-powerpc-mips.patch \
+ file://Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch \
"
SRC_URI[md5sum] = "54cf5c0ca2aa4ef7c6ac153981af34cd"