Resolves: #RHEL-108014
ppc64le, Conditional jump or move depends on uninitialised value in
dlopen->...->strcmp [rhel-10]
This commit is contained in:
Mark Wielaard 2025-08-18 16:49:28 +02:00
parent 0476c0e8eb
commit 7a72b4bbde
3 changed files with 202 additions and 1 deletions

View File

@ -0,0 +1,102 @@
From 5c912fcfaff2c7c34232562a118fa5722c6df995 Mon Sep 17 00:00:00 2001
From: Martin Cermak <mcermak@redhat.com>
Date: Fri, 8 Aug 2025 23:46:53 +0200
Subject: [PATCH 3/3] Add several missing syscall hooks to ppc64-linux
Specifically:
sys_getrlimit
sys_mincore
sys_tkill
sys_unshare
sys_splice
sys_tee
sys_vmsplice
sys_fanotify_init
sys_fanotify_mark
sys_kcmp
sys_bpf
https://bugs.kde.org/show_bug.cgi?id=508030
(cherry picked from commit 4363549490ecaeaa6c3048beeb8c5edcec33ec06)
---
NEWS | 1 +
coregrind/m_syswrap/syswrap-ppc64-linux.c | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 4e6e6c6d2387..3eea6bb1b709 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Branch 3.25.x
The following bugs have been fixed or resolved on this branch.
503241 s390x: Support z17 changes to the NNPA instruction
+508030 Add several missing syscall hooks to ppc64-linux
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 007fa6336c0e..03a5e6a822c1 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -691,7 +691,7 @@ static SyscallTableEntry syscall_table[] = {
// _____(__NR_sethostname, sys_sethostname), // 74
GENX_(__NR_setrlimit, sys_setrlimit), // 75
-// _____(__NR_getrlimit, sys_getrlimit), // 76
+ GENXY(__NR_getrlimit, sys_getrlimit), // 76
GENXY(__NR_getrusage, sys_getrusage), // 77
GENXY(__NR_gettimeofday, sys_gettimeofday), // 78
// _____(__NR_settimeofday, sys_settimeofday), // 79
@@ -847,9 +847,9 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */
GENX_(__NR_madvise, sys_madvise), // 205
-// _____(__NR_mincore, sys_mincore), // 206
+ GENXY(__NR_mincore, sys_mincore), // 206
LINX_(__NR_gettid, sys_gettid), // 207
-// _____(__NR_tkill, sys_tkill), // 208
+ LINXY(__NR_tkill, sys_tkill), // 208
LINX_(__NR_setxattr, sys_setxattr), // 209
LINX_(__NR_lsetxattr, sys_lsetxattr), // 210
@@ -934,6 +934,10 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_pselect6, sys_pselect6), // 280
LINXY(__NR_ppoll, sys_ppoll), // 281
+ LINX_(__NR_unshare, sys_unshare), // 282
+ LINX_(__NR_splice, sys_splice), // 283
+ LINX_(__NR_tee, sys_tee), // 284
+ LINXY(__NR_vmsplice, sys_vmsplice), // 285
LINXY(__NR_openat, sys_openat), // 286
LINX_(__NR_mkdirat, sys_mkdirat), // 287
@@ -972,6 +976,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_preadv, sys_preadv), // 320
LINX_(__NR_pwritev, sys_pwritev), // 321
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322
+ LINXY(__NR_fanotify_init, sys_fanotify_init), // 323
+ LINX_(__NR_fanotify_mark, sys_fanotify_mark), // 324
LINXY(__NR_prlimit64, sys_prlimit64), // 325
LINXY(__NR_socket, sys_socket), // 326
@@ -1001,6 +1007,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351
LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352
+ LINX_(__NR_kcmp, sys_kcmp), // 354
LINX_(__NR_sched_setattr, sys_sched_setattr), // 355
LINXY(__NR_sched_getattr, sys_sched_getattr), // 356
@@ -1008,6 +1015,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_getrandom, sys_getrandom), // 359
LINXY(__NR_memfd_create, sys_memfd_create), // 360
+ LINXY(__NR_bpf, sys_bpf), // 361
LINX_(__NR_execveat, sys_execveat), // 362
--
2.50.1

87
ppc64-strcmp-ld.patch Normal file
View File

@ -0,0 +1,87 @@
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index 63172b971..857f910cb 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -1508,6 +1508,12 @@ void VG_(redir_initialise) ( void )
NULL /* not mandatory - so why bother at all? */
/* glibc-2.5 (FC6, ppc64) seems fine without it */
);
+
+ add_hardwired_spec(
+ "ld64.so.2", "strcmp",
+ (Addr)&VG_(ppc64_linux_REDIR_FOR_strcmp),
+ NULL
+ );
}
# elif defined(VGP_arm_linux)
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index 2c2cc0dc2..5e1f2f147 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -602,8 +602,52 @@ VG_(ppc64_linux_REDIR_FOR_strchr):
.long 0
.byte 0,0,0,0,0,0,0,0
.L1end:
-
+ /* this function is written using the "dotless" ABI convention */
+ .align 2
+ .globl VG_(ppc64_linux_REDIR_FOR_strcmp)
+#if !defined VGP_ppc64be_linux || _CALL_ELF == 2
+ /* Little Endian uses ELF version 2 */
+ .type VG_(ppc64_linux_REDIR_FOR_strcmp),@function
+VG_(ppc64_linux_REDIR_FOR_strcmp):
+#else
+ /* Big Endian uses ELF version 1 */
+ .section ".opd","aw"
+ .align 3
+VG_(ppc64_linux_REDIR_FOR_strcmp):
+ .quad .L.VG_(ppc64_linux_REDIR_FOR_strcmp),.TOC.@tocbase,0
+ .previous
+ .size VG_(ppc64_linux_REDIR_FOR_strcmp), \
+ .LFE0-.L.VG_(ppc64_linux_REDIR_FOR_strcmp)
+ .type VG_(ppc64_linux_REDIR_FOR_strcmp), @function
+
+.L.VG_(ppc64_linux_REDIR_FOR_strcmp):
+#endif
+#if _CALL_ELF == 2
+0: addis 2,12,.TOC.-0b@ha
+ addi 2,2,.TOC.-0b@l
+ .localentry VG_(ppc64_linux_REDIR_FOR_strcmp), .-VG_(ppc64_linux_REDIR_FOR_strcmp)
+#endif
+.LFB0:
+ .cfi_startproc
+ li 10,0
+.L3:
+ lbzx 8,3,10
+ lbzx 9,4,10
+ cmpwi 0,8,0
+ beq 0,.L2
+ cmpw 0,8,9
+ addi 10,10,1
+ beq 0,.L3
+.L2:
+ subf 3,9,8
+ extsw 3,3
+ blr
+ .long 0
+ .byte 0,0,0,0,0,0,0,0
+ .cfi_endproc
+.LFE0:
+
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h
index 11d791df7..92b4fc67b 100644
--- a/coregrind/pub_core_trampoline.h
+++ b/coregrind/pub_core_trampoline.h
@@ -97,6 +97,7 @@ extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int );
#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn);
extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* );
+extern UInt VG_(ppc64_linux_REDIR_FOR_strcmp)( void*, void* );
extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int );
/* A label (sans dot) marking the ultra-magical return stub via which
all redirected and wrapped functions are made to "return" on

View File

@ -3,7 +3,7 @@
Summary: Dynamic analysis tools to detect memory or thread bugs and profile
Name: %{?scl_prefix}valgrind
Version: 3.25.1
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
# This ignores licenses that are only found in the test or perf sources
@ -88,6 +88,11 @@ Patch4: valgrind-3.16.0-some-Wl-z-now.patch
# VALGRIND_3_25_BRANCH patches
Patch5: 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch
Patch6: 0002-Bug-503241-s390x-Support-z17-changes-to-the-NNPA-ins.patch
Patch7: 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch
# Proposed upstream patches
# https://bugs.kde.org/show_bug.cgi?id=508145
Patch101: ppc64-strcmp-ld.patch
BuildRequires: make
BuildRequires: glibc-devel
@ -270,6 +275,9 @@ Valgrind User Manual for details.
%patch -P5 -p1
%patch -P6 -p1
%patch -P7 -p1
%patch -P101 -p1
%build
# LTO triggers undefined symbols in valgrind. But valgrind has a
@ -509,6 +517,10 @@ echo ===============END TESTING===============
%endif
%changelog
* Mon Aug 18 2025 Mark Wielaard <mjw@redhat.com> - 3.25.1-3
- Add ppc64-strcmp-ld.patch
- Add 0003-Add-several-missing-syscall-hooks-to-ppc64-linux.patch
* Tue Aug 5 2025 Mark Wielaard <mjw@redhat.com> - 3.25.1-2
- Add VALGRIND_3_25_BRANCH patches
- 0001-Prepare-NEWS-for-branch-3.25.x-fixes.patch