diff --git a/dyninst-9.2.0-proccontrol-attach-no-exe.patch b/dyninst-9.2.0-proccontrol-attach-no-exe.patch new file mode 100644 index 0000000..6157cae --- /dev/null +++ b/dyninst-9.2.0-proccontrol-attach-no-exe.patch @@ -0,0 +1,78 @@ +commit 6e1b36f62c0830978ab4db44f763e030cc74a18d (from 6cca9d0ee6a4676028e511e2c5384ed959b1816f) +Merge: 6cca9d0ee6a4 0be0ab88a5d9 +Author: Josh Stone +Date: Tue Aug 9 16:33:52 2016 -0700 + + Merge pull request #147 from cuviper/attach-no-exe + + proccontrol: fix process attachment without an exe + +diff --git a/proccontrol/src/linux.C b/proccontrol/src/linux.C +index 4502e357f79f..407a77ec6ecf 100644 +--- a/proccontrol/src/linux.C ++++ b/proccontrol/src/linux.C +@@ -884,8 +884,9 @@ int linux_process::computeAddrWidth() + * of name word will be 0x0 on 64 bit processes. On 32-bit process this + * word will contain a value, of which some should be non-zero. + * +- * We'll thus check every word that is 1 mod 4. If all are 0x0 we assume we're +- * looking at a 64-bit process. ++ * We'll thus check every word that is 1 mod 4 for little-endian machines, ++ * or 0 mod 4 for big-endian. If all words of either stripe are 0x0, we ++ * assume we're looking at a 64-bit process. + **/ + uint32_t buffer[256]; + char auxv_name[64]; +@@ -898,25 +899,21 @@ int linux_process::computeAddrWidth() + return -1; + } + +- long int result = read(fd, buffer, sizeof(buffer)); +- long int words_read = result / sizeof(uint32_t); +- int word_size = 8; ++ ssize_t result = read(fd, buffer, sizeof(buffer)); ++ ssize_t words_read = (result / sizeof(uint32_t)) & ~3; ++ close(fd); + + // We want to check the highest 4 bytes of each integer + // On big-endian systems, these come first in memory +- SymReader *objSymReader = getSymReader()->openSymbolReader(getExecutable()); +- int start_index = objSymReader->isBigEndianDataEncoding() ? 0 : 1; +- +- for (long int i=start_index; illproc()->getSymReader()->openSymbolReader(proc_->llproc()->getExecutable()); + abimajversion_ = abiminversion_ = 0; +- objSymReader->getABIVersion(abimajversion_, abiminversion_); ++ auto exe = proc_->libraries().getExecutable(); ++ SymReader *objSymReader = proc_->llproc()->getSymReader()->openSymbolReader(exe->getName()); ++ if (objSymReader) ++ objSymReader->getABIVersion(abimajversion_, abiminversion_); + + if (!generateInt()) return false; + diff --git a/dyninst.spec b/dyninst.spec index a9cc2df..dea2f87 100644 --- a/dyninst.spec +++ b/dyninst.spec @@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation License: LGPLv2+ Name: dyninst Group: Development/Libraries -Release: 3%{?dist} +Release: 4%{?dist} URL: http://www.dyninst.org Version: 9.2.0 # Dyninst only has full support for a few architectures. @@ -13,6 +13,8 @@ ExclusiveArch: %{ix86} x86_64 ppc ppc64 Source0: https://github.com/dyninst/dyninst/archive/v9.2.0.tar.gz#/%{name}-%{version}.tar.gz Source1: https://github.com/dyninst/dyninst/releases/download/v9.2.0/Testsuite-9.2.0.zip +Patch1: dyninst-9.2.0-proccontrol-attach-no-exe.patch + %global dyninst_base dyninst-%{version} %global testsuite_base testsuite-master @@ -83,6 +85,8 @@ making sure that dyninst works properly. %setup -q -n %{name}-%{version} -c %setup -q -T -D -a 1 +%patch1 -p1 -d %{dyninst_base} -b .attach-no-exe + %build cd %{dyninst_base} @@ -171,6 +175,9 @@ find %{buildroot}%{_libdir}/dyninst/testsuite/ \ %attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a %changelog +* Wed Sep 14 2016 Josh Stone - 9.2.0-4 +- Fix rhbz1373239, process attach without exe specified. + * Mon Aug 15 2016 Josh Stone - 9.2.0-3 - Revert aarch64 and ppc64le support until they're more complete.