Skip to contentSkip to conversation

ltp: Fix format security warnings with gcc10

PATCH In review Khem Raj 4 participants 5 messages May 20, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 ltp: Fix format security warnings with gcc10

Cc Petr Vorel <[email protected]>
Cc Daniel Díaz <[email protected]>
---
 ...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
meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch new file +32 -0
new file mode 100644
index 0000000000..d3785546c9
@@ -0,0 +1,32 @@
+From adb9587466a493fdd9d4410f1b8b130ebca06daa Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+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 <[email protected]>
+---
+ 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
+
meta/recipes-extended/ltp/ltp_20200515.bb +1 -0
index 37bad53766..e82f6b33a1 100644
@@ -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"
Signature · 1 line
2.26.2
#1 lore raw

✗ patchtest: failure for ltp: Fix format security warnings with gcc10

== Series Details ==

Series: ltp: Fix format security warnings with gcc10
Revision: 1
URL : https://patchwork.openembedded.org/series/24228/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 586061c469)

* Issue Added patch file is missing Upstream-Status in the header [test_upstream_status_presence_format]

  Suggested fix    Add Upstream-Status: <Valid status> to the header of meta/recipes-extended/ltp/ltp/0001-ptrace01-Fix-missing-format-string.patch
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
Reviewed-by on v1 1/1
#2 lore raw
In reply to Khem Raj

Hi Khem,

Quoted 3 lines
Cc Petr Vorel <[email protected]>
Cc Daniel Díaz <[email protected]>

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

#3 lore raw
In reply to Khem Raj

Hi Khem,

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

Kind regards,
Petr

#4 lore raw
Quoted 5 lines · Petr Vorel

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