elfutils/elfutils-0.182-s390-pid_memory_read.patch
DistroBaker 8109be1284 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/elfutils.git#27c1c2759c0f61a1ded0c577dcef50ac3c93adcf
2021-01-14 17:18:49 +00:00

40 lines
1.1 KiB
Diff

commit e4d985a3c1c873f77d20fa0cd421458cc2824996
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date: Thu Nov 19 20:32:24 2020 +0100
IBM Z: Fix endianess problem in pid_memory_read
The cached reads lack the big endian adjustments done in the fallback
path.
Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 3a6af997..b23139d9 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -193,14 +193,22 @@ pid_memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *arg)
{
struct __libdwfl_pid_arg *pid_arg = arg;
pid_t tid = pid_arg->tid_attached;
+ Dwfl_Process *process = dwfl->process;
assert (tid > 0);
#ifdef HAVE_PROCESS_VM_READV
if (read_cached_memory (pid_arg, addr, result))
+ {
+#if SIZEOF_LONG == 8
+# if BYTE_ORDER == BIG_ENDIAN
+ if (ebl_get_elfclass (process->ebl) == ELFCLASS32)
+ *result >>= 32;
+# endif
+#endif
return true;
+ }
#endif
- Dwfl_Process *process = dwfl->process;
if (ebl_get_elfclass (process->ebl) == ELFCLASS64)
{
#if SIZEOF_LONG == 8