summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp
diff options
context:
space:
mode:
authorDaniel Díaz <daniel.diaz@linaro.org>2019-02-25 16:02:52 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-26 23:04:09 +0000
commitecee899dec53d324053112ed8764268fef930408 (patch)
tree8134a5702a07b58d176270de4d93af3e99d8d49e /meta/recipes-extended/ltp
parent695d79af1edcc76a01055b01922f0d106c8291ca (diff)
downloadopenembedded-core-contrib-ecee899dec53d324053112ed8764268fef930408.tar.gz
ltp: Add patch for string formatting security warning
A revamp of the syscalls/setregid tests made to use a new library [LTP:7a1b4427] required a conversion to test messages. This test in particular did not include a formatted string, but a just a string element: testcases/kernel/syscalls/setregid/setregid01.c This patch allows LTP to be built with -Wformat, -Wformat-security, and -Werror=format-security. Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/ltp')
-rw-r--r--meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch46
-rw-r--r--meta/recipes-extended/ltp/ltp_20190115.bb6
2 files changed, 47 insertions, 5 deletions
diff --git a/meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch b/meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch
new file mode 100644
index 0000000000..24449148f2
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch
@@ -0,0 +1,46 @@
+From 430e05c2169ed15aaa6d7f9459edd607603cee02 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
+Date: Mon, 25 Feb 2019 10:44:33 -0600
+Subject: [PATCH] setregid01: Fix security warning for string formatting
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 8.2.0 complains with the following:
+ setregid01.c: In function 'run':
+ setregid01.c:47:3: error: format not a string literal and no format arguments [-Werror=format-security]
+ tst_res(TFAIL | TTERRNO, tc->msg);
+ ^~~~~~~
+because there is no string formatting in the message. This can
+be seen with CFLAGS set to:
+ -Wformat -Wformat-security -Werror=format-security
+as Yocto Project's Poky does, e.g.:
+ http://errors.yoctoproject.org/Errors/Details/230043/
+
+Upstream-Status: Backport [46e1eda55f188810e6bf3a939b92d604321807ae]
+
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
+Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>
+---
+ testcases/kernel/syscalls/setregid/setregid01.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/setregid/setregid01.c b/testcases/kernel/syscalls/setregid/setregid01.c
+index f2e41e134..8c9e11918 100644
+--- a/testcases/kernel/syscalls/setregid/setregid01.c
++++ b/testcases/kernel/syscalls/setregid/setregid01.c
+@@ -44,9 +44,9 @@ static void run(unsigned int n)
+ TEST(SETREGID(*tc->arg1, *tc->arg2));
+
+ if (TST_RET == -1)
+- tst_res(TFAIL | TTERRNO, tc->msg);
++ tst_res(TFAIL | TTERRNO, "%s", tc->msg);
+ else
+- tst_res(TPASS, tc->msg);
++ tst_res(TPASS, "%s", tc->msg);
+ }
+
+ static void setup(void)
+--
+2.17.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20190115.bb b/meta/recipes-extended/ltp/ltp_20190115.bb
index ed1cb27112..ddf97e26ce 100644
--- a/meta/recipes-extended/ltp/ltp_20190115.bb
+++ b/meta/recipes-extended/ltp/ltp_20190115.bb
@@ -29,11 +29,6 @@ CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
SRCREV = "a6a5caef13632e669dda27b0461726eba546a2f3"
-# ltp doesn't currently build cleanly with
-# "-Wformat -Wformat-security -Werror=format-security" in CFLAGS
-# remove this when it does
-SECURITY_STRINGFORMAT = ""
-
SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://0004-build-Add-option-to-select-libc-implementation.patch \
file://0005-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \
@@ -53,6 +48,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \
file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
+ file://setregid01-security-string-formatting.patch \
"
S = "${WORKDIR}/git"