systemtap: Backport GCC-14 related calloc fixes
PATCH 1/1 systemtap: Backport GCC-14 related calloc fixes
--- ...x-fix-build-against-upcoming-gcc-14-.patch | 40 +++++++++++++++++++ ...d-against-upcoming-gcc-14-Werror-cal.patch | 36 +++++++++++++++++ .../systemtap/systemtap_git.inc | 2 + 3 files changed, 78 insertions(+) create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch
meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch new file +40 -0
@@ -0,0 +1,40 @@ +From d42139cf9cd26d0c0363fcfe007716baeb8de517 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <[email protected]> +Date: Fri, 22 Dec 2023 19:42:38 +0000 +Subject: [PATCH] bpf-translate.cxx: fix build against upcoming `gcc-14` + (`-Werror=calloc-transposed-args`) + +`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It +detected minor infelicity in `calloc()` API usage in `systemtap`: + + bpf-translate.cxx: In function 'bpf::BPF_Section* bpf::output_probe(BPF_Output&, program&, const std::string&, unsigned int)': + bpf-translate.cxx:5044:39: error: 'void* calloc(size_t, size_t)' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] + 5044 | bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns); + | ^~~~~~~~~~~~~~~~ + bpf-translate.cxx:5044:39: note: earlier argument should specify number of elements, later size of each element + +Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=d42139cf9cd26d0c0363fcfe007716baeb8de517] +Signed-off-by: Khem Raj <[email protected]> +--- + bpf-translate.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/bpf-translate.cxx b/bpf-translate.cxx +index 1a9302463..aa8ef65ce 100644 +--- a/bpf-translate.cxx ++++ b/bpf-translate.cxx +@@ -5041,9 +5041,9 @@ output_probe(BPF_Output &eo, program &prog, + } + } + +- bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns); ++ bpf_insn *buf = (bpf_insn*) calloc (ninsns, sizeof(bpf_insn)); + assert (buf); +- Elf64_Rel *rel = (Elf64_Rel*) calloc (sizeof(Elf64_Rel), nreloc); ++ Elf64_Rel *rel = (Elf64_Rel*) calloc (nreloc, sizeof(Elf64_Rel)); + assert (rel); + + unsigned i = 0, r = 0; +-- +2.43.0 +
meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch new file +36 -0
@@ -0,0 +1,36 @@ +From 52596f023652114642faba5726c99488529029ce Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <[email protected]> +Date: Thu, 21 Dec 2023 10:00:06 +0000 +Subject: [PATCH] staprun: fix build against upcoming `gcc-14` + (`-Werror=calloc-transposed-args`) + +`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It +detected minor infelicity in `calloc()` API usage in `systemtap`: + + staprun.c: In function 'main': + staprun.c:550:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] + 550 | char ** new_argv = calloc(sizeof(char *),argc+2); + | ^~~~ + +Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=52596f023652114642faba5726c99488529029ce] +Signed-off-by: Khem Raj <[email protected]> +--- + staprun/staprun.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/staprun/staprun.c b/staprun/staprun.c +index 8437f3af6..d1b0b221b 100644 +--- a/staprun/staprun.c ++++ b/staprun/staprun.c +@@ -547,7 +547,7 @@ int main(int argc, char **argv) + us to extend argv[], with all the C fun that entails. */ + #ifdef HAVE_OPENAT + if (relay_basedir_fd >= 0) { +- char ** new_argv = calloc(sizeof(char *),argc+2); ++ char ** new_argv = calloc(argc+2, sizeof(char *)); + const int new_Foption_size = 10; /* -FNNNNN */ + char * new_Foption = malloc(new_Foption_size); + int i; +-- +2.43.0 +
meta/recipes-kernel/systemtap/systemtap_git.inc +2 -0
@@ -10,6 +10,8 @@ SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master;protocol=https \ file://0001-Makefile.am-remove-runtime-linux-uprobes-and-runtime.patch \ file://0001-prerelease-datestamp-fixes.patch \ file://0001-configure.ac-fix-broken-libdebuginfod-library-auto-d.patch \ + file://0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch \ + file://0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch \ " COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux'
Signature · 1 line
2.43.0
Patchtest results for [PATCH] systemtap: Backport GCC-14 related calloc fixes
Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:
---
Testing patch /home/patchtest/share/mboxes/systemtap-Backport-GCC-14-related-calloc-fixes.patch
FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)
PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)
---
Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!