From 6299dfcd101fa77087104520a16ec6059677c8b3 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Tue, 8 Jun 2021 12:30:57 -0700 Subject: [PATCH] Backport fix for s390x and drop the ExcludeArch --- ...5634b513cca4bf40fd99e97fef6652dcc75f.patch | 30 +++++++++++++++++++ python-drgn.spec | 10 ++++--- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 82ca5634b513cca4bf40fd99e97fef6652dcc75f.patch diff --git a/82ca5634b513cca4bf40fd99e97fef6652dcc75f.patch b/82ca5634b513cca4bf40fd99e97fef6652dcc75f.patch new file mode 100644 index 0000000..6c7a88f --- /dev/null +++ b/82ca5634b513cca4bf40fd99e97fef6652dcc75f.patch @@ -0,0 +1,30 @@ +From 82ca5634b513cca4bf40fd99e97fef6652dcc75f Mon Sep 17 00:00:00 2001 +From: Omar Sandoval +Date: Tue, 8 Jun 2021 12:05:42 -0700 +Subject: [PATCH] libdrgn: fix copying value to big-endian from little-endian + +copy_lsbytes() doesn't copy enough bytes when copying from a smaller +little-endian value to a larger big-endian value. This was caught by the +test cases for DW_OP_deref{,_size}, but it can affect other places when +debugging a little-endian target from a big-endian host or vice-versa. + +Closes #105. + +Signed-off-by: Omar Sandoval +--- + libdrgn/serialize.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdrgn/serialize.h b/libdrgn/serialize.h +index da3ba91a..0f4783f3 100644 +--- a/libdrgn/serialize.h ++++ b/libdrgn/serialize.h +@@ -65,7 +65,7 @@ static inline void copy_lsbytes(void *dst, size_t dst_size, + } else { + memset(d, 0, dst_size - size); + if (src_little_endian) { +- for (size_t i = dst_size - size; i < size; i++) ++ for (size_t i = dst_size - size; i < dst_size; i++) + d[i] = s[dst_size - 1 - i]; + } else { + memcpy(d + dst_size - size, s + src_size - size, size); diff --git a/python-drgn.spec b/python-drgn.spec index 7e36a31..84bbdf8 100644 --- a/python-drgn.spec +++ b/python-drgn.spec @@ -15,12 +15,14 @@ scripting in Python.} Name: python-%{pypi_name} Version: 0.0.13 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Scriptable debugger library License: GPLv3+ URL: https://github.com/osandov/drgn Source0: %{pypi_source} +# libdrgn: fix copying value to big-endian from little-endian +Patch0: %{url}/commit/82ca5634b513cca4bf40fd99e97fef6652dcc75f.patch BuildRequires: python3-devel BuildRequires: python3dist(setuptools) @@ -40,9 +42,6 @@ BuildRequires: libkdumpfile-devel BuildRequires: zlib-devel BuildRequires: xz-devel -# https://github.com/osandov/drgn/issues/105 -ExcludeArch: s390x - %description %{common_description} @@ -111,6 +110,9 @@ cp -PR examples tools %{buildroot}%{_datadir}/drgn %endif %changelog +* Tue Jun 8 2021 Davide Cavalca - 0.0.13-2 +- Backport fix for s390x and drop the ExcludeArch + * Tue Jun 8 2021 Davide Cavalca - 0.0.13-1 - Update to 0.0.13 - Drop no longer needed ExcludeArch for armv7hl and i686