libpcp: fix endian issue in big-endian __pmTimestamp writing
Resolves: RHEL-69722
This commit is contained in:
parent
1e817d692e
commit
2d27ea2254
93
big-endian-timestamps.patch
Normal file
93
big-endian-timestamps.patch
Normal file
@ -0,0 +1,93 @@
|
||||
commit 4df35d2b5070f289bf3856f035551cde8ca22e06
|
||||
Author: Nathan Scott <nathans@redhat.com>
|
||||
Date: Thu Jan 30 12:11:26 2025 +1100
|
||||
|
||||
libpcp: fix endian issue in big-endian __pmTimestamp writing
|
||||
|
||||
Mirror an earlier endian fix in the reading code for big-endian
|
||||
platforms for writing __pmTimestamp structures. Affects v3 log
|
||||
writing only, and big endian platforms only.
|
||||
|
||||
Some minor code cleanup also; fix an unused-function warning on
|
||||
big endian build machines and keep the various timestamp get/put
|
||||
routines together in logmeta.c for easier cross-referencing.
|
||||
|
||||
Resolves Red Hat bug RHEL-69722
|
||||
Resolves github issue #2110
|
||||
|
||||
diff --git a/src/libpcp/src/endian.c b/src/libpcp/src/endian.c
|
||||
index fc6d931f99..f700fc9c56 100644
|
||||
--- a/src/libpcp/src/endian.c
|
||||
+++ b/src/libpcp/src/endian.c
|
||||
@@ -77,6 +77,7 @@ __ntohpmLabel(pmLabel * const label)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifndef __htonpmValueBlock
|
||||
static void
|
||||
__htonpmTimespec(pmTimespec * const tsp)
|
||||
{
|
||||
@@ -84,7 +85,6 @@ __htonpmTimespec(pmTimespec * const tsp)
|
||||
__htonll((char *)&tsp->tv_nsec);
|
||||
}
|
||||
|
||||
-#ifndef __htonpmValueBlock
|
||||
static void
|
||||
htonEventArray(pmValueBlock * const vb, int highres)
|
||||
{
|
||||
diff --git a/src/libpcp/src/logmeta.c b/src/libpcp/src/logmeta.c
|
||||
index 9db81af860..e04545d425 100644
|
||||
--- a/src/libpcp/src/logmeta.c
|
||||
+++ b/src/libpcp/src/logmeta.c
|
||||
@@ -1823,17 +1823,6 @@ __pmLoadTimestamp(const __int32_t *buf, __pmTimestamp *tsp)
|
||||
}
|
||||
}
|
||||
|
||||
-void
|
||||
-__pmLoadTimeval(const __int32_t *buf, __pmTimestamp *tsp)
|
||||
-{
|
||||
- tsp->sec = (__int32_t)ntohl(buf[0]);
|
||||
- tsp->nsec = ntohl(buf[1]) * 1000;
|
||||
- if (pmDebugOptions.logmeta && pmDebugOptions.desperate) {
|
||||
- fprintf(stderr, "__pmLoadTimeval: network(%08x %08x usec)", buf[0], buf[1]);
|
||||
- fprintf(stderr, " -> %" FMT_INT64 ".%09d (%llx %x nsec)\n", tsp->sec, tsp->nsec, (long long)tsp->sec, tsp->nsec);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
void
|
||||
__pmPutTimestamp(const __pmTimestamp *tsp, __int32_t *buf)
|
||||
{
|
||||
@@ -1845,8 +1834,13 @@ __pmPutTimestamp(const __pmTimestamp *tsp, __int32_t *buf)
|
||||
* need to dodge endian issues here ... want the MSB 32-bits of sec
|
||||
* in buf[0] and the LSB 32 bits of sec in buf[1]
|
||||
*/
|
||||
- buf[0] = (stamp.sec >> 32) & 0xffffffff;
|
||||
- buf[1] = stamp.sec & 0xffffffff;
|
||||
+#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
+ buf[0] = (__int32_t)((__int64_t)(stamp.sec >> 32));
|
||||
+ buf[1] = (__int32_t)((__int64_t)(stamp.sec & 0x00000000ffffffffLL));
|
||||
+#else
|
||||
+ buf[1] = (__int32_t)((__int64_t)(stamp.sec >> 32));
|
||||
+ buf[0] = (__int32_t)((__int64_t)(stamp.sec & 0x00000000ffffffffLL));
|
||||
+#endif
|
||||
buf[2] = stamp.nsec;
|
||||
if (pmDebugOptions.logmeta && pmDebugOptions.desperate) {
|
||||
fprintf(stderr, "__pmPutTimestamp: %" FMT_INT64 ".%09d (%llx %x nsec)", tsp->sec, tsp->nsec, (long long)tsp->sec, tsp->nsec);
|
||||
@@ -1854,6 +1848,17 @@ __pmPutTimestamp(const __pmTimestamp *tsp, __int32_t *buf)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+__pmLoadTimeval(const __int32_t *buf, __pmTimestamp *tsp)
|
||||
+{
|
||||
+ tsp->sec = (__int32_t)ntohl(buf[0]);
|
||||
+ tsp->nsec = ntohl(buf[1]) * 1000;
|
||||
+ if (pmDebugOptions.logmeta && pmDebugOptions.desperate) {
|
||||
+ fprintf(stderr, "__pmLoadTimeval: network(%08x %08x usec)", buf[0], buf[1]);
|
||||
+ fprintf(stderr, " -> %" FMT_INT64 ".%09d (%llx %x nsec)\n", tsp->sec, tsp->nsec, (long long)tsp->sec, tsp->nsec);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
__pmPutTimeval(const __pmTimestamp *tsp, __int32_t *buf)
|
||||
{
|
6
pcp.spec
6
pcp.spec
@ -1,6 +1,6 @@
|
||||
Name: pcp
|
||||
Version: 6.3.2
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: System-level performance monitoring and performance management
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
|
||||
URL: https://pcp.io
|
||||
@ -9,6 +9,7 @@ Source0: https://github.com/performancecopilot/pcp/releases/pcp-%{version}.src.t
|
||||
|
||||
Patch0: pcp-xsos-fixes.patch
|
||||
Patch1: selinux-pmie-and-pmlogger.patch
|
||||
Patch2: big-endian-timestamps.patch
|
||||
|
||||
%if 0%{?fedora} >= 40 || 0%{?rhel} >= 10
|
||||
ExcludeArch: %{ix86}
|
||||
@ -3601,6 +3602,9 @@ fi
|
||||
%files zeroconf -f pcp-zeroconf-files.rpm
|
||||
|
||||
%changelog
|
||||
* Fri Jan 31 2025 Nathan Scott <nathans@redhat.com> - 6.3.2-5
|
||||
- Fix writing of v3 archive timestamps on s390x (RHEL-69722)
|
||||
|
||||
* Thu Jan 23 2025 Zdenek Pytela <zpytela@redhat.com> - 6.3.2-4
|
||||
- Rebuild with selinux-policy-40.13.23-1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user