diff options
author | Daniel Díaz <daniel.diaz@linaro.org> | 2019-02-25 16:02:52 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-26 23:04:31 +0000 |
commit | 9ea8ca7f62ea5e9865f871ef79337b2fa9867cdc (patch) | |
tree | e5f2b788b75b585bb55409769392cbd0f4032b0d /meta/recipes-extended/ltp/ltp | |
parent | ce9a6606d7791320502383f92cf4d9935f09a2b3 (diff) | |
download | poky-9ea8ca7f62ea5e9865f871ef79337b2fa9867cdc.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.
(From OE-Core rev: ecee899dec53d324053112ed8764268fef930408)
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/ltp')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/setregid01-security-string-formatting.patch | 46 |
1 files changed, 46 insertions, 0 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 @@ | |||
1 | From 430e05c2169ed15aaa6d7f9459edd607603cee02 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org> | ||
3 | Date: Mon, 25 Feb 2019 10:44:33 -0600 | ||
4 | Subject: [PATCH] setregid01: Fix security warning for string formatting | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | GCC 8.2.0 complains with the following: | ||
10 | setregid01.c: In function 'run': | ||
11 | setregid01.c:47:3: error: format not a string literal and no format arguments [-Werror=format-security] | ||
12 | tst_res(TFAIL | TTERRNO, tc->msg); | ||
13 | ^~~~~~~ | ||
14 | because there is no string formatting in the message. This can | ||
15 | be seen with CFLAGS set to: | ||
16 | -Wformat -Wformat-security -Werror=format-security | ||
17 | as Yocto Project's Poky does, e.g.: | ||
18 | http://errors.yoctoproject.org/Errors/Details/230043/ | ||
19 | |||
20 | Upstream-Status: Backport [46e1eda55f188810e6bf3a939b92d604321807ae] | ||
21 | |||
22 | Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> | ||
23 | Reviewed-by: Enji Cooper <yaneurabeya@gmail.com> | ||
24 | --- | ||
25 | testcases/kernel/syscalls/setregid/setregid01.c | 4 ++-- | ||
26 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
27 | |||
28 | diff --git a/testcases/kernel/syscalls/setregid/setregid01.c b/testcases/kernel/syscalls/setregid/setregid01.c | ||
29 | index f2e41e134..8c9e11918 100644 | ||
30 | --- a/testcases/kernel/syscalls/setregid/setregid01.c | ||
31 | +++ b/testcases/kernel/syscalls/setregid/setregid01.c | ||
32 | @@ -44,9 +44,9 @@ static void run(unsigned int n) | ||
33 | TEST(SETREGID(*tc->arg1, *tc->arg2)); | ||
34 | |||
35 | if (TST_RET == -1) | ||
36 | - tst_res(TFAIL | TTERRNO, tc->msg); | ||
37 | + tst_res(TFAIL | TTERRNO, "%s", tc->msg); | ||
38 | else | ||
39 | - tst_res(TPASS, tc->msg); | ||
40 | + tst_res(TPASS, "%s", tc->msg); | ||
41 | } | ||
42 | |||
43 | static void setup(void) | ||
44 | -- | ||
45 | 2.17.1 | ||
46 | |||