ltp: Fix format security warnings with gcc10

Submitted by Khem Raj on May 20, 2020, 5:26 a.m. | Patch ID: 172713

Details

Message ID 20200520052634.3291199-1-raj.khem@gmail.com
State New
Headers show

Commit Message

Khem Raj May 20, 2020, 5:26 a.m.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Petr Vorel <petr.vorel@gmail.com>
Cc: Daniel Díaz <daniel.diaz@linaro.org>
---
 ...1-ptrace01-Fix-missing-format-string.patch | 32 +++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20200515.bb     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch

Patch hide | download patch | download mbox

diff --git a/meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch b/meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch
new file mode 100644
index 0000000000..d3785546c9
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch
@@ -0,0 +1,32 @@ 
+From adb9587466a493fdd9d4410f1b8b130ebca06daa Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 19 May 2020 22:21:23 -0700
+Subject: [PATCH] ptrace01: Fix missing format string
+
+Fixes
+| ptrace01.c:89:2: error: format string is not a string literal
+(potentially insecure) [-Werror,-Wformat-security]
+|         tst_res(TINFO, tc->message);
+|         ^              ~~~~~~~~~~~
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ testcases/kernel/syscalls/ptrace/ptrace01.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/ptrace/ptrace01.c b/testcases/kernel/syscalls/ptrace/ptrace01.c
+index 87a99e4150..9071bbabaf 100644
+--- a/testcases/kernel/syscalls/ptrace/ptrace01.c
++++ b/testcases/kernel/syscalls/ptrace/ptrace01.c
+@@ -86,7 +86,7 @@ static void run(unsigned int i)
+ 
+ 	got_signal = 0;
+ 
+-	tst_res(TINFO, tc->message);
++	tst_res(TINFO, "%s", tc->message);
+ 
+ 	if (tc->handler == 1) {
+ 		parent_act.sa_handler = parent_handler;
+-- 
+2.26.2
+
diff --git a/meta/recipes-extended/ltp/ltp_20200515.bb b/meta/recipes-extended/ltp/ltp_20200515.bb
index 37bad53766..e82f6b33a1 100644
--- a/meta/recipes-extended/ltp/ltp_20200515.bb
+++ b/meta/recipes-extended/ltp/ltp_20200515.bb
@@ -34,6 +34,7 @@  SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://0004-guard-mallocopt-with-__GLIBC__.patch \
            file://0007-Fix-test_proc_kill-hanging.patch \
            file://0001-Add-more-musl-exclusions.patch \
+           file://0001-ptrace01-Fix-missing-format-string.patch \
            "
 
 S = "${WORKDIR}/git"

Comments

Petr Vorel May 20, 2020, 6:07 a.m.
Hi Khem,

> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Petr Vorel <petr.vorel@gmail.com>
> Cc: Daniel Díaz <daniel.diaz@linaro.org>

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

Nice, just easy fix. Please just send patch to LTP ML.
Some time ago I tried to add -Wformat-security in upstream LTP travis CI, don't
remember why I haven't finished the effort. If this is the only needed fix,
we'll enable it.

BTW how to add -Wformat-security in for openembedded-core (for next time)?

Kind regards,
Petr
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#138502): https://lists.openembedded.org/g/openembedded-core/message/138502
Mute This Topic: https://lists.openembedded.org/mt/74343691/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Petr Vorel May 20, 2020, 6:18 a.m.
Hi Khem,

I see patch has already merged in upstream.
How about adding Upstream status: 58424835952641f4fd60c0ae3ab6c64decca3f8a

Kind regards,
Petr
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#138503): https://lists.openembedded.org/g/openembedded-core/message/138503
Mute This Topic: https://lists.openembedded.org/mt/74343691/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-
Richard Purdie May 20, 2020, 11:05 a.m.
On Wed, 2020-05-20 at 08:18 +0200, Petr Vorel wrote:
> Hi Khem,
> 
> I see patch has already merged in upstream.
> How about adding Upstream status:
> 58424835952641f4fd60c0ae3ab6c64decca3f8a

I tweaked it to Upstream-Status: backport.

Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#138505): https://lists.openembedded.org/g/openembedded-core/message/138505
Mute This Topic: https://lists.openembedded.org/mt/74343691/3617530
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-