SHA256
1
0
forked from pool/systemtap

Accepting request 1164226 from home:jones_tony:branches:devel:tools

- Fix runtime issues with v6.8 kernel (bsc#1222249)
    New patch: get-shm_flag-defines-from-the-appropriate-include-file-for-linux-6.8-kernel.patch
    New patch: pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
- Fix gcc14 build errors (bsc#1221706)
    New patch: bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
    New patch: pr31288-build-with-gcc14-cont.patch
    New patch: pr31288-build-with-gcc14.patch
    New patch: staprun-fix-build-against-upcoming-gcc14.patch
    New patch: stapvirt.c-more-gcc-14-werror-calloc-transposed-args-compatibility.patch

OBS-URL: https://build.opensuse.org/request/show/1164226
OBS-URL: https://build.opensuse.org/package/show/devel:tools/systemtap?expand=0&rev=148
This commit is contained in:
Tony Jones 2024-04-02 19:00:34 +00:00 committed by Git OBS Bridge
parent b7c241a997
commit 54d088036b
9 changed files with 1533 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From: Sergei Trofimovich <slyich@gmail.com>
Date: Fri Dec 22 19:42:38 2023 +0000
Subject: bpf-translate.cxx: fix build against upcoming `gcc-14`
Git-commit: d42139cf9cd26d0c0363fcfe007716baeb8de517
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
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
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;

View File

@ -0,0 +1,41 @@
From: William Cohen <wcohen@redhat.com>
Date: Tue Feb 20 09:22:34 2024 -0500
Subject: Get SHM_* flag defines from the appropriate include file for Linux 6.8 kernel
Git-commit: 8a9097d906867d364bc94f9c1552f240ca609422
References: bsc#1222249
Signed-off-by: Tony Jones <tonyj@suse.de>
Get SHM_* flag defines from the appropriate include file for Linux 6.8 kernels
Linux git commit bc46ef3cea3d6f6 removed the include/uapi/linux/shm.h
from include/linux/shm.h. For the newer Linux 6.8 kernels need to get
SHM_* defines directly from include/uapi/linux/shm.h.
diff --git a/tapset/linux/aux_syscalls.stp b/tapset/linux/aux_syscalls.stp
index e773ba7c2..fa915af8f 100644
--- a/tapset/linux/aux_syscalls.stp
+++ b/tapset/linux/aux_syscalls.stp
@@ -3405,7 +3405,11 @@ function _dup3_flag_str:string(f:long)
%}
%{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0)
#include <linux/shm.h>
+#else
+#include <uapi/linux/shm.h>
+#endif
static const _stp_val_array _stp_shmat_list[] = {
V(SHM_RDONLY),
V(SHM_RND),
@@ -4149,7 +4153,11 @@ CATCH_DEREF_FAULT();
%{
#include <linux/ipc.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0)
#include <linux/shm.h>
+#else
+#include <uapi/linux/shm.h>
+#endif
static const _stp_val_array _stp_shmget_flags_list[] = {
V(IPC_CREAT),
V(IPC_EXCL),

View File

@ -0,0 +1,31 @@
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Jan 25 16:46:33 2024 -0500
Subject: PR31288: build with gcc14 cont'd
Git-commit: 11353cf4e90b2344db5609a543c5ccd894550831
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
diff --git a/runtime/softfloat.c b/runtime/softfloat.c
index 709e45d2f..869efdf46 100644
--- a/runtime/softfloat.c
+++ b/runtime/softfloat.c
@@ -614,6 +614,7 @@ uint_fast64_t
|Converting a fp to a str
*------------------------------------------------------------------------*/
+char* itoa(uint64_t val);
char* itoa(uint64_t val)
{
int base = 10;
diff --git a/stapregex.cxx b/stapregex.cxx
index e25992bb2..d0371beee 100644
--- a/stapregex.cxx
+++ b/stapregex.cxx
@@ -103,6 +103,7 @@ void
stapdfa::emit_declaration (translator_output *o) const
{
o->newline() << "// DFA for \"" << orig_input << "\"";
+ o->newline() << "int " << func_name << " (struct context * __restrict__ c, const char *str);";
o->newline() << "int " << func_name << " (struct context * __restrict__ c, const char *str) {";
o->indent(1);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
From: William Cohen <wcohen@redhat.com>
Date: Wed Feb 14 09:33:30 2024 -0500
Subject: PR31373: Deal with the removal of strlcpy() from linux 6.8
Git-commit: 60c3d8b1c90c58ca7c048ef24e1b03c6c04b36ad
References: bsc#1222249
Signed-off-by: Tony Jones <tonyj@suse.de>
PR31373: Deal with the removal of strlcpy() from linux 6.8
The Linux 6.8 kernels removed strlcpy() with git commit d26270061a in
January 2024. All the kernel's strlcpy() uses were converted to
strscpy(). Systemtap needed to do the same. This is implemented in
systemtap with a strlcpy macro in the runtime that translates the
strscpy() return value into the equivalent strlcpy() value.
diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
index 1fa62c7ed..0e9fe3fea 100644
--- a/runtime/linux/runtime.h
+++ b/runtime/linux/runtime.h
@@ -48,6 +48,20 @@
#include <generated/compile.h>
#endif
+// PR31373: Linux 6.8 kernel removed strlcpy
+// This provides equivalent to strlcpy using strscpy
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
+#define strlcpy(dest, src, count) ({ \
+ size_t size=(count); \
+ ssize_t retval = strscpy((dest), (src), size);\
+ if (retval<0) \
+ retval = size; /* was truncated */ \
+ else \
+ retval++; /* count the NULL */ \
+ retval; \
+})
+#endif
+
// PR26811: Replace some declarations after set_fs() removal in kernel 5.10+.
// Should use the STP_* prefixed defines outside of STAPCONF_SET_FS.
#if defined(STAPCONF_SET_FS)

View File

@ -0,0 +1,30 @@
From: Sergei Trofimovich <slyich@gmail.com>
Date: Thu Dec 21 10:00:06 2023 +0000
Subject: staprun: fix build against upcoming `gcc-14`
Git-commit: 52596f023652114642faba5726c99488529029ce
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
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);
| ^~~~
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;

View File

@ -0,0 +1,40 @@
From: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Jan 18 16:37:39 2024 -0500
Subject: stapvirt.c: More gcc-14 -Werror=calloc-transposed-args compatibility
Git-commit: 6c0b92b340db23ccc49e18007d4ecbdef3306bd6
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
stapvirt.c: More gcc-14 -Werror=calloc-transposed-args compatibility
diff --git a/stapvirt.c b/stapvirt.c
index 0a10fa8fe..af02a4f76 100644
--- a/stapvirt.c
+++ b/stapvirt.c
@@ -119,7 +119,7 @@ getActiveDomains(virConnectPtr conn, int **ids)
if (idsn <= 0)
return idsn;
- *ids = (int*) calloc(sizeof(int), idsn);
+ *ids = (int*) calloc(idsn, sizeof(int));
if (*ids == NULL)
return -1;
@@ -145,7 +145,7 @@ getInactiveDomains(virConnectPtr conn, char ***names)
if (namesn <= 0)
return namesn;
- *names = (char**) calloc(sizeof(char*), namesn);
+ *names = (char**) calloc(namesn, sizeof(char*));
if (*names == NULL)
return -1;
@@ -188,7 +188,7 @@ getAllDomains(virConnectPtr conn, virDomainPtr **domains)
goto cleanup_names;
// Time to prepare virDomainPtr array
- *domains = (virDomainPtr*) calloc(sizeof(virDomainPtr), idsn+namesn);
+ *domains = (virDomainPtr*) calloc(idsn+namesn, sizeof(virDomainPtr));
if (*domains == NULL) {
err("Can't allocate domains array\n");
goto cleanup_names;

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Apr 2 17:32:02 UTC 2024 - Tony Jones <tonyj@suse.com>
- Fix runtime issues with v6.8 kernel (bsc#1222249)
New patch: get-shm_flag-defines-from-the-appropriate-include-file-for-linux-6.8-kernel.patch
New patch: pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
-------------------------------------------------------------------
Thu Mar 28 01:06:45 UTC 2024 - Tony Jones <tonyj@suse.com>
- Fix gcc14 build errors (bsc#1221706)
New patch: bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
New patch: pr31288-build-with-gcc14-cont.patch
New patch: pr31288-build-with-gcc14.patch
New patch: staprun-fix-build-against-upcoming-gcc14.patch
New patch: stapvirt.c-more-gcc-14-werror-calloc-transposed-args-compatibility.patch
-------------------------------------------------------------------
Fri Mar 8 15:56:21 UTC 2024 - pgajdos@suse.com

View File

@ -33,6 +33,13 @@ Source3: README-BEFORE-ADDING-PATCHES
Source4: README-KEYRING
Source5: stap-server.conf
Patch1: systemtap-build-source-dir.patch
Patch2: staprun-fix-build-against-upcoming-gcc14.patch
Patch3: bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
Patch4: stapvirt.c-more-gcc-14-werror-calloc-transposed-args-compatibility.patch
Patch5: pr31288-build-with-gcc14.patch
Patch6: pr31288-build-with-gcc14-cont.patch
Patch7: get-shm_flag-defines-from-the-appropriate-include-file-for-linux-6.8-kernel.patch
Patch8: pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
BuildRequires: autoconf >= 2.71
BuildRequires: automake