Bug 1221706

Summary: GCC 14: systemtap package fails
Product: [openSUSE] openSUSE Tumbleweed Reporter: Michal Jireš <michal.jires>
Component: DevelopmentAssignee: Tony Jones <tonyj>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: tonyj
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
See Also: https://bugzilla.opensuse.org/show_bug.cgi?id=1225933
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 1220574    

Description Michal Jireš 2024-03-19 12:31:39 UTC
Building systemtap with GCC 14 fails here:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/systemtap/standard/x86_64

Due to:

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
bpf-translate.cxx:5046:41: 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]
 5046 |   Elf64_Rel *rel = (Elf64_Rel*) calloc (sizeof(Elf64_Rel), nreloc);
      |                                         ^~~~~~~~~~~~~~~~~
bpf-translate.cxx:5046:41: note: earlier argument should specify number of elements, later size of each element

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);
      |                                                  ^~~~
staprun.c:550:50: note: earlier argument should specify number of elements, later size of each element





Builds with automatically generated:

Index: systemtap-5.0/bpf-translate.cxx
===================================================================
--- systemtap-5.0.orig/bpf-translate.cxx
+++ systemtap-5.0/bpf-translate.cxx
@@ -5041,9 +5041,9 @@ output_probe(BPF_Output &eo, program &pr
 	}
     }

-  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;
Index: systemtap-5.0/staprun/staprun.c
===================================================================
--- systemtap-5.0.orig/staprun/staprun.c
+++ systemtap-5.0/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;
Comment 1 Tony Jones 2024-03-28 15:20:41 UTC
I fixed the gcc build issue yesterday but during testing I noticed current systemtap in openSUSE-release-20240326-2824.1 appears to be broken on even the most basic "hello world".

I'm on vacation today&tomorrow but I was going to look at this over the weekend when I'm back.

If you need the build issue fixed before then changes are in:  
home:jones_tony:branches:devel:tools/systemtap  (see systemtap.changes)
Comment 2 Tony Jones 2024-04-02 19:22:57 UTC
Fix pushed.

Runtime errors resolved via bsc#1222249
Comment 3 OBSbugzilla Bot 2024-04-02 19:55:06 UTC
This is an autogenerated message for OBS integration:
This bug (1221706) was mentioned in
https://build.opensuse.org/request/show/1164227 Factory / systemtap