SHA256
1
0
forked from pool/systemtap
systemtap/pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
Tony Jones 54d088036b 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
2024-04-02 19:00:34 +00:00

41 lines
1.5 KiB
Diff

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)