Fix rhbz1373239, process attach without exe specified.
This commit is contained in:
parent
d36617a20e
commit
eafaeab37f
78
dyninst-9.2.0-proccontrol-attach-no-exe.patch
Normal file
78
dyninst-9.2.0-proccontrol-attach-no-exe.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
commit 6e1b36f62c0830978ab4db44f763e030cc74a18d (from 6cca9d0ee6a4676028e511e2c5384ed959b1816f)
|
||||||
|
Merge: 6cca9d0ee6a4 0be0ab88a5d9
|
||||||
|
Author: Josh Stone <cuviper@gmail.com>
|
||||||
|
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; i<words_read; i+= 4)
|
||||||
|
+ bool be_zero = true, le_zero = true;
|
||||||
|
+ for (ssize_t i=0; i<words_read; i+= 4)
|
||||||
|
{
|
||||||
|
- if (buffer[i] != 0) {
|
||||||
|
- word_size = 4;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
+ be_zero &= buffer[i] == 0;
|
||||||
|
+ le_zero &= buffer[i+1] == 0;
|
||||||
|
}
|
||||||
|
- close(fd);
|
||||||
|
|
||||||
|
- pthrd_printf("computeAddrWidth: Offset set to %d, word size is %d\n", start_index, word_size);
|
||||||
|
+ int word_size = (be_zero || le_zero) ? 8 : 4;
|
||||||
|
+ pthrd_printf("computeAddrWidth: word size is %d\n", word_size);
|
||||||
|
return word_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/proccontrol/src/loadLibrary/codegen.C b/proccontrol/src/loadLibrary/codegen.C
|
||||||
|
index 9d545a7a5f70..a29b61450a04 100644
|
||||||
|
--- a/proccontrol/src/loadLibrary/codegen.C
|
||||||
|
+++ b/proccontrol/src/loadLibrary/codegen.C
|
||||||
|
@@ -33,9 +33,11 @@ bool Codegen::generate() {
|
||||||
|
|
||||||
|
buffer_.initialize(codeStart_, size);
|
||||||
|
|
||||||
|
- SymReader *objSymReader = proc_->llproc()->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;
|
||||||
|
|
@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation
|
|||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Name: dyninst
|
Name: dyninst
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
URL: http://www.dyninst.org
|
URL: http://www.dyninst.org
|
||||||
Version: 9.2.0
|
Version: 9.2.0
|
||||||
# Dyninst only has full support for a few architectures.
|
# 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
|
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
|
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 dyninst_base dyninst-%{version}
|
||||||
%global testsuite_base testsuite-master
|
%global testsuite_base testsuite-master
|
||||||
|
|
||||||
@ -83,6 +85,8 @@ making sure that dyninst works properly.
|
|||||||
%setup -q -n %{name}-%{version} -c
|
%setup -q -n %{name}-%{version} -c
|
||||||
%setup -q -T -D -a 1
|
%setup -q -T -D -a 1
|
||||||
|
|
||||||
|
%patch1 -p1 -d %{dyninst_base} -b .attach-no-exe
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
cd %{dyninst_base}
|
cd %{dyninst_base}
|
||||||
@ -171,6 +175,9 @@ find %{buildroot}%{_libdir}/dyninst/testsuite/ \
|
|||||||
%attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a
|
%attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 14 2016 Josh Stone <jistone@redhat.com> - 9.2.0-4
|
||||||
|
- Fix rhbz1373239, process attach without exe specified.
|
||||||
|
|
||||||
* Mon Aug 15 2016 Josh Stone <jistone@redhat.com> - 9.2.0-3
|
* Mon Aug 15 2016 Josh Stone <jistone@redhat.com> - 9.2.0-3
|
||||||
- Revert aarch64 and ppc64le support until they're more complete.
|
- Revert aarch64 and ppc64le support until they're more complete.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user