From cb379f3155ee2119f7b4d72879fb6e0038004d2a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:20:29 +0000 Subject: import dyninst-8.2.0-2.el7 --- diff --git a/.dyninst.metadata b/.dyninst.metadata index b4d4668..00e8677 100644 --- a/.dyninst.metadata +++ b/.dyninst.metadata @@ -1,3 +1,3 @@ -1a0817b533e0400cb2ef63d3d24b776cd62f2f26 SOURCES/dyninst-8.1-postponed-syscall.patch.xz -f4b3a3879935a1a48f817509419aa86944529e55 SOURCES/dyninst-8.1.2.tar.gz -6d8d64610baf3d14b08034237b5131a4654702a0 SOURCES/dyninst-docs-8.1.1.tar.gz +d8f3294524f1008bbb90e53b4868c80b43db9a47 SOURCES/dyninst-8.2.0.1.tar.gz +4c861851f7e5d09225a920e6d8987aa41e0dfe50 SOURCES/dyninst-docs-8.2.0.1.tar.gz +d202c4b34415da2d6958e2b218760c5ca08b26cf SOURCES/dyninst-testsuite-8.2.0.1.tar.gz diff --git a/.gitignore b/.gitignore index dfe8f9f..51e8e13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/dyninst-8.1-postponed-syscall.patch.xz -SOURCES/dyninst-8.1.2.tar.gz -SOURCES/dyninst-docs-8.1.1.tar.gz +SOURCES/dyninst-8.2.0.1.tar.gz +SOURCES/dyninst-docs-8.2.0.1.tar.gz +SOURCES/dyninst-testsuite-8.2.0.1.tar.gz diff --git a/SOURCES/dyninst-8.1-findMain.patch b/SOURCES/dyninst-8.1-findMain.patch deleted file mode 100644 index 52951ed..0000000 --- a/SOURCES/dyninst-8.1-findMain.patch +++ /dev/null @@ -1,392 +0,0 @@ -commit 5934afb83c7908b313c48f70e71b84a8b9000b35 -Author: Josh Stone -Date: Tue Jan 14 13:39:36 2014 -0800 - - Dyninst 8.1 backport of image::findMain fixes - - commit 44205dbd2d9011d1cfc366e775f861bad2146c2b - Author: Josh Stone - Date: Tue Jan 14 13:39:36 2014 -0800 - - dyninstAPI: Let image::findMain inspect PIE too - - Position-independent executables (PIE) are generally indistinguishable - from any other shared object, but we still need to find main() in these - when they're stripped. One clue is the presence of INTERP, which PIEs - will always have. (Some DSOs also have INTERP, but this is rare.) - - commit 335aeb15f09a951c536f60475cafc84882cbfc1c - Author: Josh Stone - Date: Tue Jan 14 12:34:10 2014 -0800 - - dyninstAPI: Expand powerpc support in image::findMain - - First, this function needs to respect the ELF entry address, rather than - assuming that entry is at the start of the .text section. This was - already handled in x86, so we just need the same in powerpc. - - Second, we need to add ppc64 support to the section which currently - handles ppc32. This requires dereferencing .opd indirection, and ppc64 - also uses a TOC-based load which the current dataflowAPI code can't - handle. For this case, just use a simple InstructionAPI eval with the - known TOC r2 register. - - commit ed3ab720945492a42bf36d358e105ef1bd34c950 - Author: Josh Stone - Date: Wed Jan 15 11:20:32 2014 -0800 - - dyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL - - When we look for new symbols in image::findMain, it's not really the - intent to make these global/exported symbols. It doesn't matter so much - for live processes, but these shouldn't be exported in rewritten - binaries. This patch sets them as LOCAL and INTERNAL instead. - - Note, this is only for Linux and FreeBSD, but Windows may want it too. - - commit 49606ee86625d2505112f55f77817981c498b606 - Author: Josh Stone - Date: Mon Jan 27 17:45:32 2014 -0800 - - common: Skip get_immediate_operand without any imm - - For x86 image::findMain, we blindly look for the first call from the - entry address, then grab the immediate operand from the preceding - instruction. Sometimes that instruction may not even have any immediate - operands, and the heuristic fails with a message on stderr like: - - arch-x86.C[5602]: invalid immediate size 0 in insn - - This now occurs with some ET_DYN binaries that are allowed by commit - 44205dbd2d90, when those are really DSOs and not PIE. However, this - could conceivably also happen for any executable that doesn't fit the - heuristic pattern. - - This patch quietly returns 0 from get_immediate_operand when there are - no operands, and image::findMain will treat this as an invalid address. - -diff --git a/common/src/arch-x86.C b/common/src/arch-x86.C -index e805585bf22c..73efd3cd18df 100644 ---- a/common/src/arch-x86.C -+++ b/common/src/arch-x86.C -@@ -5581,6 +5581,9 @@ Address get_immediate_operand(instruction *instr) - - ia32_decode(IA32_FULL_DECODER,(const unsigned char *)(instr->ptr()),detail); - -+ if (loc.imm_cnt < 1) -+ return 0; -+ - // now find the immediate value in the locations - Address immediate = 0; - -diff --git a/dyninstAPI/src/image.C b/dyninstAPI/src/image.C -index dbe05a7cadd6..f2af21a15a8d 100644 ---- a/dyninstAPI/src/image.C -+++ b/dyninstAPI/src/image.C -@@ -269,6 +269,29 @@ namespace { - void * fini_addr; - }; - -+ void *get_raw_symtab_ptr(Symtab *linkedFile, Address addr) -+ { -+ Region *reg = linkedFile->findEnclosingRegion(addr); -+ if (reg != NULL) { -+ char *data = (char*)reg->getPtrToRawData(); -+ data += addr - reg->getMemOffset(); -+ return data; -+ } -+ return NULL; -+ } -+ -+ Address deref_opd(Symtab *linkedFile, Address addr) -+ { -+ Region *reg = linkedFile->findEnclosingRegion(addr); -+ if (reg && reg->getRegionName() == ".opd") { -+ // opd symbol needing dereference -+ void *data = get_raw_symtab_ptr(linkedFile, addr); -+ if (data) -+ return *(Address*)data; -+ } -+ return addr; -+ } -+ - /* - * b ends with a call to libc_start_main. We are looking for the - * value in GR8, which is the address of a structure that contains -@@ -289,6 +312,7 @@ namespace { - b->end()-b->start(), - b->region()->getArch()); - -+ RegisterAST::Ptr r2( new RegisterAST(ppc32::r2) ); - RegisterAST::Ptr r8( new RegisterAST(ppc32::r8) ); - - Address cur_addr = b->start(); -@@ -302,50 +326,67 @@ namespace { - if(!r8_def) - return 0; - -- // Get all of the assignments that happen in this instruction -- AssignmentConverter conv(true); -- vector assigns; -- conv.convert(r8_def,r8_def_addr,f,b,assigns); -- -- // find the one we care about (r8) -- vector::iterator ait = assigns.begin(); -- for( ; ait != assigns.end(); ++ait) { -- AbsRegion & outReg = (*ait)->out(); -- Absloc const& loc = outReg.absloc(); -- if(loc.reg() == r8->getID()) -- break; -- } -- if(ait == assigns.end()) { -- return 0; -+ Address ss_addr = 0; -+ -+ // Try a TOC-based lookup first -+ if (r8_def->isRead(r2)) { -+ set memReads; -+ r8_def->getMemoryReadOperands(memReads); -+ Address TOC = f->obj()->cs()->getTOC(r8_def_addr); -+ if (TOC != 0 && memReads.size() == 1) { -+ Expression::Ptr expr = *memReads.begin(); -+ expr->bind(r2.get(), Result(u64, TOC)); -+ const Result &res = expr->eval(); -+ if (res.defined) { -+ void *res_addr = -+ get_raw_symtab_ptr(linkedFile, res.convert
()); -+ if (res_addr) -+ ss_addr = *(Address*)res_addr; -+ } -+ } - } - -- // Slice back to the definition of R8, and, if possible, simplify -- // to a constant -- Slicer slc(*ait,b,f); -- Default_Predicates preds; -- Graph::Ptr slg = slc.backwardSlice(preds); -- DataflowAPI::Result_t sl_res; -- DataflowAPI::SymEval::expand(slg,sl_res); -- AST::Ptr calculation = sl_res[*ait]; -- SimpleArithVisitor visit; -- AST::Ptr simplified = calculation->accept(&visit); -- //printf("after simplification:\n%s\n",simplified->format().c_str()); -- if(simplified->getID() == AST::V_ConstantAST) { -- ConstantAST::Ptr cp = ConstantAST::convert(simplified); -- Address ss_addr = cp->val().val; -- -- // need a pointer to the image data -- SymtabAPI::Region * dreg = linkedFile->findEnclosingRegion(ss_addr); -- -- if(dreg) { -- struct libc_startup_info * si = -- (struct libc_startup_info *)( -- ((Address)dreg->getPtrToRawData()) + -- ss_addr - (Address)dreg->getMemOffset()); -- return (Address)si->main_addr; -+ if (ss_addr == 0) { -+ // Get all of the assignments that happen in this instruction -+ AssignmentConverter conv(true); -+ vector assigns; -+ conv.convert(r8_def,r8_def_addr,f,b,assigns); -+ -+ // find the one we care about (r8) -+ vector::iterator ait = assigns.begin(); -+ for( ; ait != assigns.end(); ++ait) { -+ AbsRegion & outReg = (*ait)->out(); -+ Absloc const& loc = outReg.absloc(); -+ if(loc.reg() == r8->getID()) -+ break; -+ } -+ if(ait == assigns.end()) { -+ return 0; -+ } -+ -+ // Slice back to the definition of R8, and, if possible, simplify -+ // to a constant -+ Slicer slc(*ait,b,f); -+ Default_Predicates preds; -+ Graph::Ptr slg = slc.backwardSlice(preds); -+ DataflowAPI::Result_t sl_res; -+ DataflowAPI::SymEval::expand(slg,sl_res); -+ AST::Ptr calculation = sl_res[*ait]; -+ SimpleArithVisitor visit; -+ AST::Ptr simplified = calculation->accept(&visit); -+ //printf("after simplification:\n%s\n",simplified->format().c_str()); -+ if(simplified->getID() == AST::V_ConstantAST) { -+ ConstantAST::Ptr cp = ConstantAST::convert(simplified); -+ ss_addr = cp->val().val; - } - } - -+ // need a pointer to the image data -+ auto si = (struct libc_startup_info *) -+ get_raw_symtab_ptr(linkedFile, ss_addr); -+ if (si) -+ return (Address)si->main_addr; -+ - return 0; - } - } -@@ -358,10 +399,13 @@ namespace { - */ - void image::findMain() - { --#if defined(ppc32_linux) || defined(ppc32_bgp) -+#if defined(ppc32_linux) || defined(ppc32_bgp) || defined(ppc64_linux) - using namespace Dyninst::InstructionAPI; - -- if(!desc_.isSharedObject()) -+ // Only look for main in executables, but do allow position-independent -+ // executables (PIE) which look like shared objects with an INTERP. -+ // (Some strange DSOs also have INTERP, but this is rare.) -+ if(!desc_.isSharedObject() || linkedFile->getInterpreterName() != NULL) - { - bool foundMain = false; - bool foundStart = false; -@@ -381,22 +425,21 @@ void image::findMain() - if (foundText == false) { - return; - } -- -- if( !foundMain ) -- { -+ -+ if( !foundMain ) -+ { - logLine("No main symbol found: attempting to create symbol for main\n"); -- const unsigned char* p; -- p = (( const unsigned char * ) eReg->getPtrToRawData()); - -- Address mainAddress = 0; -+ Address eAddr = linkedFile->getEntryOffset(); -+ eAddr = deref_opd(linkedFile, eAddr); - - bool parseInAllLoadableRegions = (BPatch_normalMode != mode_); - SymtabCodeSource scs(linkedFile, filt, parseInAllLoadableRegions); - CodeObject tco(&scs,NULL,NULL,false); - -- tco.parse(eReg->getMemOffset(),false); -+ tco.parse(eAddr,false); - set regions; -- scs.findRegions(eReg->getMemOffset(),regions); -+ scs.findRegions(eAddr,regions); - if(regions.empty()) { - // express puzzlement - return; -@@ -404,23 +447,31 @@ void image::findMain() - SymtabCodeRegion * reg = - static_cast(*regions.begin()); - Function * func = -- tco.findFuncByEntry(reg,eReg->getMemOffset()); -+ tco.findFuncByEntry(reg,eAddr); - if(!func) { - // again, puzzlement - return; - } - -+ Block * b = NULL; - const Function::edgelist & calls = func->callEdges(); -- if(calls.size() != 1) { -+ if (calls.empty()) { -+ // when there are no calls, let's hope the entry block is it -+ b = tco.findBlockByEntry(reg,eAddr); -+ } else if(calls.size() == 1) { -+ Function::edgelist::iterator cit = calls.begin(); -+ b = (*cit)->src(); -+ } else { - startup_printf("%s[%d] _start has unexpected number (%d) of" - " call edges, bailing on findMain()\n", - FILE__,__LINE__,calls.size()); -- return; -+ return; - } -- Function::edgelist::iterator cit = calls.begin(); -- Block * b = (*cit)->src(); -+ if (!b) return; -+ -+ Address mainAddress = evaluate_main_address(linkedFile,func,b); -+ mainAddress = deref_opd(linkedFile, mainAddress); - -- mainAddress = evaluate_main_address(linkedFile,func,b); - if(0 == mainAddress || !scs.isValidAddress(mainAddress)) { - startup_printf("%s[%d] failed to find main\n",FILE__,__LINE__); - return; -@@ -430,8 +481,8 @@ void image::findMain() - } - Symbol *newSym= new Symbol( "main", - Symbol::ST_FUNCTION, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - mainAddress, - linkedFile->getDefaultModule(), - eReg, -@@ -444,7 +495,10 @@ void image::findMain() - || defined(i386_unknown_solaris2_5) \ - || (defined(os_freebsd) \ - && (defined(arch_x86) || defined(arch_x86_64))) -- if(!desc_.isSharedObject()) -+ // Only look for main in executables, but do allow position-independent -+ // executables (PIE) which look like shared objects with an INTERP. -+ // (Some strange DSOs also have INTERP, but this is rare.) -+ if(!desc_.isSharedObject() || linkedFile->getInterpreterName() != NULL) - { - bool foundMain = false; - bool foundStart = false; -@@ -594,8 +648,8 @@ void image::findMain() - //logLine( "No static symbol for function main\n" ); - Symbol *newSym = new Symbol("DYNINST_pltMain", - Symbol::ST_FUNCTION, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - mainAddress, - linkedFile->getDefaultModule(), - eReg, -@@ -606,8 +660,8 @@ void image::findMain() - { - Symbol *newSym= new Symbol( "main", - Symbol::ST_FUNCTION, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - mainAddress, - linkedFile->getDefaultModule(), - eReg, -@@ -619,8 +673,8 @@ void image::findMain() - { - Symbol *startSym = new Symbol( "_start", - Symbol::ST_FUNCTION, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - eReg->getMemOffset(), - linkedFile->getDefaultModule(), - eReg, -@@ -635,8 +689,8 @@ void image::findMain() - if (linkedFile->findRegion(finisec,".fini")) { - Symbol *finiSym = new Symbol( "_fini", - Symbol::ST_FUNCTION, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - finisec->getMemOffset(), - linkedFile->getDefaultModule(), - finisec, -@@ -657,8 +711,8 @@ void image::findMain() - { - Symbol *newSym = new Symbol( "_DYNAMIC", - Symbol::ST_OBJECT, -- Symbol::SL_GLOBAL, -- Symbol::SV_DEFAULT, -+ Symbol::SL_LOCAL, -+ Symbol::SV_INTERNAL, - dynamicsec->getMemOffset(), - linkedFile->getDefaultModule(), - dynamicsec, diff --git a/SOURCES/dyninst-8.1.2-testsuite-opt.patch b/SOURCES/dyninst-8.1.2-testsuite-opt.patch deleted file mode 100644 index 548ad30..0000000 --- a/SOURCES/dyninst-8.1.2-testsuite-opt.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up dyninst/testsuite/make.module.tmpl.testsuite-opt dyninst/testsuite/make.module.tmpl ---- dyninst/testsuite/make.module.tmpl.testsuite-opt 2013-12-11 17:01:03.278606211 -0800 -+++ dyninst/testsuite/make.module.tmpl 2013-12-11 17:02:24.593743942 -0800 -@@ -23,7 +23,7 @@ LFLAGS = -L../../common/$(PLATFORM) -L.. - # Turn off NO_INITIALIZER_LIST_SUPPORT if we compile test suite with C++11 - CFLAGS = $(UNIFIED_TEST_DEF:%=%_test) $(ARCH_FLAGS) $(AC_DEF) $(FIRST_INCLUDE) $(IFLAGS) -I../src -g $(BOOST_INCDIR) $(CPPFLAGS) - CXXFLAGS = $(CFLAGS) --CXXFLAGS += $(PLATFORM_CXXFLAGS) $(CXX_REQ_FLAGS) -+CXXFLAGS += $(PLATFORM_CXXFLAGS) -std=c++11 - - CFLAGS_NATIVE = $(CFLAGS) - CXXFLAGS_NATIVE = $(CXXFLAGS) diff --git a/SOURCES/dyninst-install-testsuite.patch b/SOURCES/dyninst-install-testsuite.patch deleted file mode 100644 index a57135f..0000000 --- a/SOURCES/dyninst-install-testsuite.patch +++ /dev/null @@ -1,238 +0,0 @@ -commit 701eb936767886bfd7b8858e8e2151173f9dc6bd -Author: Josh Stone -Date: Tue Feb 26 09:34:52 2013 -0800 - - Hack the testsuite into shape for installation - - * testsuite/make.module.tmpl: Forgo rpath, and install all targets. - * testsuite/src/runTests-utils.C (setupVars): Don't complain about the - scripts dir, as it's not actually needed anyway. - * testsuite/src/test_driver.C (getRTLibDir): Hack out the builddir path, - and just use ../ (aka %{libdir}/dyninst/testsuite/../) - -diff --git a/testsuite/make.module.tmpl b/testsuite/make.module.tmpl -index 1d3ce2c..1c76d8f 100644 ---- a/testsuite/make.module.tmpl -+++ b/testsuite/make.module.tmpl -@@ -227,7 +227,7 @@ proccontrol_COMPONENT_LIB = $(LIBPROCCONTROLCOMP) - SPACE := - SPACE += - #COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl,--enable-new-dtags$(ALL_COMP_DIRS:%=,-rpath,%)) --COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl$(ALL_COMP_DIRS:%=,-rpath,%)) -+#COMPONENT_LDFLAGS += $(subst $(SPACE),,-Wl$(ALL_COMP_DIRS:%=,-rpath,%)) - - all: default - -@@ -246,8 +246,19 @@ full: test-full - ### A list of all the targets we're building, for install purposes - ####################################################################### - --ALL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS)) --LIBTESTSUITE_DEST = $(addprefix $(TEST_DEST)/,$(LIBTESTSUITE)) -+TEST_DEST ?= $(LIBRARY_DEST)/testsuite -+ -+ALL_TARGETS = $(LIBTESTLAUNCH) $(LIBTESTSUITE) $(TESTLIBS) -+ALL_TARGETS += $(MUTATORS) $(MUTATEES_MINIMUM) -+ALL_TARGETS += $(DRIVERS) $(OUTPUT_DRIVERS) $(COMPONENTS) -+ -+FULL_TARGETS = $(LIBTESTLAUNCH) $(LIBTESTSUITE) $(TESTLIBS) -+FULL_TARGETS += $(MUTATORS) $(MUTATEES) -+FULL_TARGETS += $(DRIVERS) $(OUTPUT_DRIVERS) $(COMPONENTS) -+ -+ALL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS)) -+FULL_TARGETS_DEST = $(addprefix $(TEST_DEST)/,$(FULL_TARGETS)) -+LIBTESTSUITE_DEST = $(addprefix $(TEST_DEST)/,$(LIBTESTSUITE)) - - ####################################################################### - ### Some pattern rules -@@ -274,13 +285,11 @@ include make.mutators.gen - - include make.solo_mutatee.gen - --mutatees: -- --mutators: -- --components: -- --testlibs: -+MUTATEES = -+MUTATEES_MINIMUM = -+MUTATORS = -+COMPONENTS = -+TESTLIBS = - - ####################################################################### - ### Filter results, if needed -@@ -296,13 +305,13 @@ include $(TO_CORE)/make.components - - ifneq ($(wildcard ../src/dyninst), ) - ifneq ($(findstring dyninstAPI,$(fullSystem)),) --mutatees: $(filter-out $(BUILD_FILTER), $(dyninst_SOLO_MUTATEES)) --mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES))) --mutators: $(dyninst_MUTATORS_SO) --components: $(LIBDYNINSTCOMP) --testlibs: $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS) -+MUTATEES += $(filter-out $(BUILD_FILTER), $(dyninst_SOLO_MUTATEES)) -+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES))) -+MUTATORS += $(dyninst_MUTATORS_SO) -+COMPONENTS += $(LIBDYNINSTCOMP) -+TESTLIBS += $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS) - ifndef SKIP_BUILD_RTLIB_32 --testlibs: $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI) -+TESTLIBS += $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI) - dyninst_targs = $(DYNINST_TESTLIBS_ABI) $(DYNINST_STATIC_TESTLIBS_ABI) - endif - dyninst_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES))) -@@ -312,11 +321,11 @@ endif - - ifneq ($(wildcard ../src/symtab), ) - ifneq ($(findstring symtabAPI,$(fullSystem)),) --mutatees: $(filter-out $(BUILD_FILTER), $(symtab_SOLO_MUTATEES)) --mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES))) --mutators: $(symtab_MUTATORS_SO) --components: $(LIBSYMTABCOMP) --testlibs: $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS) -+MUTATEES += $(filter-out $(BUILD_FILTER), $(symtab_SOLO_MUTATEES)) -+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES))) -+MUTATORS += $(symtab_MUTATORS_SO) -+COMPONENTS += $(LIBSYMTABCOMP) -+TESTLIBS += $(DYNINST_TESTLIBS) $(DYNINST_STATIC_TESTLIBS) - symtab_targs = $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES))) - symtab_targs = $(symtab_MUTATORS_SO) $(LIBSYMTABCOMP) - endif -@@ -324,12 +333,12 @@ endif - - ifneq ($(wildcard ../src/instruction), ) - ifneq ($(findstring instructionAPI,$(fullSystem)),) --mutatees: $(filter-out $(BUILD_FILTER), $(instruction_SOLO_MUTATEES)) --mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES))) --mutators: $(instruction_MUTATORS_SO) -+MUTATEES += $(filter-out $(BUILD_FILTER), $(instruction_SOLO_MUTATEES)) -+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES))) -+MUTATORS += $(instruction_MUTATORS_SO) - ifneq ($(instruction_MUTATORS_SO), ) --components: $(LIBINSTRUCTIONCOMP) --testlibs: -+COMPONENTS += $(LIBINSTRUCTIONCOMP) -+TESTLIBS += - instruction_targs = $(LIBINSTRUCTIONCOMP) - endif - instruction_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES))) -@@ -339,12 +348,12 @@ endif - - ifneq ($(wildcard ../src/proccontrol), ) - ifneq ($(findstring proccontrol,$(fullSystem)),) --mutatees: $(filter-out $(BUILD_FILTER), $(proccontrol_SOLO_MUTATEES)) --mutatees_minimum: $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES))) --mutators: $(proccontrol_MUTATORS_SO) -+MUTATEES += $(filter-out $(BUILD_FILTER), $(proccontrol_SOLO_MUTATEES)) -+MUTATEES_MINIMUM += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES))) -+MUTATORS += $(proccontrol_MUTATORS_SO) - ifneq ($(proccontrol_MUTATORS_SO), ) --components: $(LIBPROCCONTROLCOMP) --testlibs: $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI) -+COMPONENTS += $(LIBPROCCONTROLCOMP) -+TESTLIBS += $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI) - proccontrol_targs = $(LIBPROCCONTROLCOMP) $(PROCCONTROL_TESTLIBS) $(PROCCONTROL_TESTLIBS_ABI) $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI) - endif - proccontrol_targs += $(filter-out $(BUILD_FILTER), $(filter-out $(MINIMUM_BUILD_FILTER), $(proccontrol_SOLO_MUTATEES))) -@@ -352,6 +361,16 @@ proccontrol_targs += $(proccontrol_MUTATORS_SO) - endif - endif - -+mutatees: $(MUTATEES) -+ -+mutatees_minimum: $(MUTATEES_MINIMUM) -+ -+mutators: $(MUTATORS) -+ -+components: $(COMPONENTS) -+ -+testlibs: $(TESTLIBS) -+ - common_infra: drivers output_drivers - - dyninstAPI: common_infra $(dyninst_targs) $(symtab_targs) $(instruction_targs) $(proccontrol_targs) -@@ -362,7 +381,13 @@ instructionAPI: common_infra $(instruction_targs) - - proccontrol: common_infra $(proccontrol_targs) - --install: default -+install: $(TEST_DEST) -+ -+install-full: $(TEST_DEST) -+ -+$(TEST_DEST)/%: % -+ @echo Installing $@ -+ $(HIDE_COMP)$(INSTALL) -t $(TEST_DEST) $< - - symlink: all - -@@ -412,7 +437,8 @@ endif - - testlibs: $(LIBTESTSUITE) - --drivers: test_driver runTests testdriver_wrapper -+DRIVERS = test_driver runTests testdriver_wrapper -+drivers: $(DRIVERS) - - .PHONY: clean install distclean mutators mutatees testlibs gnu_mutatees native_mutatees echo all - -@@ -566,7 +592,8 @@ endif - - # Install directory - $(TEST_DEST): -- mkdir $(TEST_DEST) -+ @echo Installing $@ -+ $(HIDE_COMP)$(INSTALL) -d $(TEST_DEST) - - ####################################################################### - ### Generic Mutator build rule: -@@ -857,3 +884,6 @@ endif - endif - endif - endif -+ -+install: $(ALL_TARGETS_DEST) -+install-full: $(FULL_TARGETS_DEST) -diff --git a/testsuite/src/runTests-utils.C b/testsuite/src/runTests-utils.C -index 0f54874..02bd505 100644 ---- a/testsuite/src/runTests-utils.C -+++ b/testsuite/src/runTests-utils.C -@@ -403,12 +403,14 @@ void setupVars(bool useLog, string &logfile) - } - - pdscrdir = base_dir + "/dyninst/scripts"; -+#if 0 - if ( ! isDir(pdscrdir) ) - { - cerr << pdscrdir << " does not exist. Paradyn scripts dir required." - << endl; - exit(1); - } -+#endif - - // Determine Test log dir - char *pdtst = getenv("PDTST"); -diff --git a/testsuite/src/test_driver.C b/testsuite/src/test_driver.C -index 0fc3117..31def33 100644 ---- a/testsuite/src/test_driver.C -+++ b/testsuite/src/test_driver.C -@@ -805,6 +805,8 @@ void updateSearchPaths(const char *filename) { - } - - std::string getRTLibDir() { -+ return "../"; -+#if 0 - char *platform = getenv("PLATFORM"); - char cwd[1024]; - if (!platform) { -@@ -822,6 +824,7 @@ std::string getRTLibDir() { - std::string rtlib = "../../dyninstAPI_RT/"; - rtlib += platform; - return rtlib; -+#endif - } - - #if !defined(os_windows_test) diff --git a/SOURCES/dyninst-rhbz1007500.patch b/SOURCES/dyninst-rhbz1007500.patch deleted file mode 100644 index 50f11a2..0000000 --- a/SOURCES/dyninst-rhbz1007500.patch +++ /dev/null @@ -1,80 +0,0 @@ -commit 7cb54ca93cffc949b16611d5b6c66844524143d8 -Author: Josh Stone -Date: Thu Oct 17 16:05:25 2013 -0700 - - Fix DYNINST_index_lock state and ppc64 writeFunctionPtr - - There are two fixes in this patch to resolve hangs that we've seen on - ppc64 tests, most notably in test_thread_5. - - The first is that DYNINST_index_lock may be left in a locked state from - DYNINSTthreadIndexSLOW when DYNINST_thread_hash_size is 0. This simply - needs an unlock in that error path. - - The second resolves *why* DYNINST_thread_hash_size is 0, even after it - was correctly initialized to 40. This turned out to be corruption when - the mutator writeFunctionPtr sets DYNINST_pthread_self. Those symbols - in libdyninstAPI_RT.so happen to be arranged like so: - - 0000000000031180 B DYNINST_pthread_self - 0000000000031188 B DYNINST_sysEntry - 0000000000031190 B DYNINST_thread_hash_size - - So writeFunctionPtr was sending three longs: the function descriptor - correctly in DYNINST_pthread_self; the toc in DYNINST_sysEntry, a dead - variable; and the guilty 0x0 in DYNINST_thread_hash_size. The only - thing a function pointer actually needs is the function descriptor. - - For comparison, on EL5 and EL6 our build has the symbols like so: - - 000000000002c400 B DYNINST_pthread_self - 000000000002c408 B DYNINSTlinkSave - 000000000002c410 B DYNINSTtocSave - 000000000002c418 B DYNINST_sysEntry - 000000000002c420 B DYNINST_thread_hash_tids - 000000000002c428 B DYNINST_thread_hash_size - - So that still clobbered data, but DYNINSTlinkSave and DYNINSTtocSave are - both unused variables -- no harm done. - - Signed-off-by: Josh Stone - -diff --git a/dyninstAPI/src/inst-power.C b/dyninstAPI/src/inst-power.C -index c2accaf..74436ec 100644 ---- a/dyninstAPI/src/inst-power.C -+++ b/dyninstAPI/src/inst-power.C -@@ -2589,20 +2589,11 @@ bool writeFunctionPtr(AddressSpace *p, Address addr, func_instance *f) - #else - // 64-bit ELF PowerPC Linux uses r2 (same as AIX) for TOC base register - if (p->getAddressWidth() == sizeof(uint64_t)) { -- Address buffer[3]; - Address val_to_write = f->addr(); - // Use function descriptor address, if available. - if (f->getPtrAddress()) val_to_write = f->getPtrAddress(); -- assert(p->proc()); -- Address toc = p->proc()->getTOCoffsetInfo(f); -- buffer[0] = val_to_write; -- buffer[1] = toc; -- buffer[2] = 0x0; -- -- if (!p->writeDataSpace((void *) addr, sizeof(buffer), buffer)) -- fprintf(stderr, "%s[%d]: writeDataSpace failed\n", -- FILE__, __LINE__); -- return true; -+ return p->writeDataSpace((void *) addr, -+ sizeof(val_to_write), &val_to_write); - } - else { - // Originally copied from inst-x86.C -diff --git a/dyninstAPI_RT/src/RTthread.c b/dyninstAPI_RT/src/RTthread.c -index 9897563..2a80f58 100644 ---- a/dyninstAPI_RT/src/RTthread.c -+++ b/dyninstAPI_RT/src/RTthread.c -@@ -119,6 +119,7 @@ unsigned DYNINSTthreadIndexSLOW(dyntid_t tid) { - **/ - if (!DYNINST_thread_hash_size) { - //Uninitialized tramp guard. -+ tc_lock_unlock(&DYNINST_index_lock); - return DYNINST_max_num_threads; - } - diff --git a/SOURCES/dyninst-rhbz1152270.patch b/SOURCES/dyninst-rhbz1152270.patch new file mode 100644 index 0000000..a67a461 --- /dev/null +++ b/SOURCES/dyninst-rhbz1152270.patch @@ -0,0 +1,44 @@ +From b37d305d0421017b61235e9c2015f3e45f082161 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 16 Oct 2014 17:42:58 -0700 +Subject: [PATCH] cmake: Properly extend BUG_DEFINES on ppc linux + +Both ppc32_linux and ppc64_linux set -Dbug_registers_after_exit in +BUG_DEFINES, but in doing so they clobbered the general linux bugs. In +particular, -Dbug_syscall_changepc_rewind is still needed. This patch +lets ppc just add its definition while keeping the others. + +Our RHEL7 QA noticed this as a regression from 8.1.2, so I believe it +just broke as part of the transition to cmake. In their smoke test, a +mutatee process in sleep() is attached, and it promptly crashes SIGILL +on the first iRPC. I found that the iRPC was at 0x3fffb1f70000, and +proccontrol is setting that pc, but the crash is at 0x3fffb1f6fffc. So +that appears to be the rewind issue, and a full BUG_DEFINES fixes it. + +Reported-by: Michael Petlan +Signed-off-by: Josh Stone +--- + cmake/cap_arch_def.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/cap_arch_def.cmake b/cmake/cap_arch_def.cmake +index a27be73e3652..d685532dcd2f 100644 +--- a/cmake/cap_arch_def.cmake ++++ b/cmake/cap_arch_def.cmake +@@ -112,11 +112,11 @@ set (OLD_DEFINES -Dx86_64_unknown_linux2_4) + + elseif (PLATFORM STREQUAL ppc32_linux) + set (OLD_DEFINES -Dppc32_linux) +-set (BUG_DEFINES -Dbug_registers_after_exit) ++set (BUG_DEFINES ${BUG_DEFINES} -Dbug_registers_after_exit) + + elseif (PLATFORM STREQUAL ppc64_linux) + set (OLD_DEFINES -Dppc64_linux) +-set (BUG_DEFINES ${BUG_DEF} -Dbug_registers_after_exit) ++set (BUG_DEFINES ${BUG_DEFINES} -Dbug_registers_after_exit) + + elseif (PLATFORM STREQUAL ppc64_bgq_ion) + set (OLD_DEFINES -Dppc64_bluegene -Dppc64_linux) +-- +1.8.3.1 + diff --git a/SOURCES/dyninst-rpm-build-flags.patch b/SOURCES/dyninst-rpm-build-flags.patch deleted file mode 100644 index 73b4f18..0000000 --- a/SOURCES/dyninst-rpm-build-flags.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- dyninst/make.config.buildflags 2013-02-14 11:23:18.717002871 -0800 -+++ dyninst/make.config 2013-02-14 11:23:46.588871846 -0800 -@@ -570,9 +570,9 @@ ifeq (ppc64_linux, $(findstring ppc64_li - endif - - # flags for normal (non-kludge) files, with common warnings --CFLAGS = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS) -+CFLAGS += $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS) - CXXFLAGS += $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS) --LDFLAGS = $(ARCH_FLAGS) -+LDFLAGS += $(ARCH_FLAGS) - - # flags for kludge files, won't have warnings generated - KFLAGS = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS) diff --git a/SPECS/dyninst.spec b/SPECS/dyninst.spec index af46f61..54b0204 100644 --- a/SPECS/dyninst.spec +++ b/SPECS/dyninst.spec @@ -2,33 +2,34 @@ Summary: An API for Run-time Code Generation License: LGPLv2+ Name: dyninst Group: Development/Libraries -Release: 6%{?dist} +Release: 2%{?dist} URL: http://www.dyninst.org -Version: 8.1.2 +Version: 8.2.0 Exclusiveos: linux -#Right now dyninst does not know about the following architectures -ExcludeArch: s390 s390x %{arm} +#dyninst only knows the following architectures +ExclusiveArch: %{ix86} x86_64 ppc ppc64 # The source for this package was pulled from upstream's vcs. Use the # following commands to generate the tarball: # git clone http://git.dyninst.org/dyninst.git; cd dyninst -# git archive --format=tar.gz --prefix=dyninst/ v8.1.2 > dyninst-8.1.2.tar.gz +# git archive --format=tar.gz --prefix=dyninst/ v8.2.0.1 > dyninst-8.2.0.1.tar.gz # git clone http://git.dyninst.org/docs.git; cd docs -# git archive --format=tar.gz v8.1.1 > dyninst-docs-8.1.1.tar.gz +# git archive --format=tar.gz --prefix=docs/ v8.2.0.1 > dyninst-docs-8.2.0.1.tar.gz +# git clone http://git.dyninst.org/testsuite.git; cd testsuite +# git archive --format=tar.gz --prefix=testsuite/ v8.2.0.1 > dyninst-testsuite-8.2.0.1.tar.gz # Verify the commit ids with: -# gunzip -c dyninst-8.1.2.tar.gz | git get-tar-commit-id -# gunzip -c dyninst-docs-8.1.1.tar.gz | git get-tar-commit-id -Source0: %{name}-%{version}.tar.gz -Source1: %{name}-docs-8.1.1.tar.gz -Patch1: dyninst-rpm-build-flags.patch -Patch2: dyninst-install-testsuite.patch -Patch3: dyninst-rhbz1007500.patch -Patch4: dyninst-8.1-postponed-syscall.patch.xz -Patch5: dyninst-8.1-findMain.patch -Patch6: dyninst-8.1.2-testsuite-opt.patch +# gunzip -c dyninst-8.2.0.1.tar.gz | git get-tar-commit-id +# gunzip -c dyninst-docs-8.2.0.1.tar.gz | git get-tar-commit-id +# gunzip -c dyninst-testsuite-8.2.0.1.tar.gz | git get-tar-commit-id +Source0: dyninst-%{version}.1.tar.gz +Source1: dyninst-docs-%{version}.1.tar.gz +Source2: dyninst-testsuite-%{version}.1.tar.gz +Patch1: dyninst-rhbz1152270.patch BuildRequires: libdwarf-devel >= 20111030 BuildRequires: elfutils-libelf-devel BuildRequires: boost-devel +BuildRequires: binutils-devel +BuildRequires: cmake # Extra requires just for the testsuite BuildRequires: gcc-gfortran glibc-static libstdc++-static nasm @@ -61,6 +62,7 @@ Summary: Header files for the compiling programs with Dyninst Group: Development/System Requires: dyninst = %{version}-%{release} Requires: boost-devel + %description devel dyninst-devel includes the C header files that specify the Dyninst user-space libraries and interfaces. This is required for rebuilding any program @@ -77,7 +79,10 @@ the dyninst user-space libraries and interfaces. %package testsuite Summary: Programs for testing Dyninst Group: Development/System +Requires: dyninst = %{version}-%{release} Requires: dyninst-devel = %{version}-%{release} +Requires: dyninst-static = %{version}-%{release} +Requires: glibc-static %description testsuite dyninst-testsuite includes the test harness and target programs for making sure that dyninst works properly. @@ -85,28 +90,44 @@ making sure that dyninst works properly. %prep %setup -q -n %{name}-%{version} -c %setup -q -T -D -a 1 +%setup -q -T -D -a 2 pushd dyninst -%patch1 -p1 -b .buildflags -%patch2 -p1 -b .testsuite -%patch3 -p1 -b .rhbz1007500 -%patch4 -p1 -b .postponed-syscall -%patch5 -p1 -b .findMain -%patch6 -p1 -b .testsuite-opt +%patch1 -p1 -b .rhbz1152270 popd %build cd dyninst -%configure --includedir=%{_includedir}/dyninst --libdir=%{_libdir}/dyninst -make %{?_smp_mflags} VERBOSE_COMPILATION=1 +%cmake \ + -DINSTALL_LIB_DIR:PATH=%{_libdir}/dyninst \ + -DINSTALL_INCLUDE_DIR:PATH=%{_includedir}/dyninst \ + -DINSTALL_CMAKE_DIR:PATH=%{_libdir}/cmake/Dyninst \ + -DCMAKE_SKIP_RPATH:BOOL=YES +make %{?_smp_mflags} + +# Hack to install dyninst nearby, so the testsuite can use it +make DESTDIR=../install install +sed -i -e 's!%{_libdir}/dyninst!../install%{_libdir}/dyninst!' \ + ../install%{_libdir}/cmake/Dyninst/*.cmake + +cd ../testsuite +%cmake \ + -DDyninst_DIR:PATH=../install%{_libdir}/cmake/Dyninst \ + -DINSTALL_DIR:PATH=%{_libdir}/dyninst/testsuite \ + -DCMAKE_BUILD_TYPE:STRING=Debug \ + -DCMAKE_SKIP_RPATH:BOOL=YES +make %{?_smp_mflags} %install cd dyninst make DESTDIR=%{buildroot} install +cd ../testsuite +make DESTDIR=%{buildroot} install + mkdir -p %{buildroot}/etc/ld.so.conf.d echo "%{_libdir}/dyninst" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf @@ -136,19 +157,22 @@ chmod 644 %{buildroot}%{_libdir}/dyninst/testsuite/* %files doc %defattr(-,root,root,-) -%doc dynC_API.pdf -%doc DyninstAPI.pdf -%doc InstructionAPI.pdf -%doc ParseAPI.pdf -%doc PatchAPI.pdf -%doc ProcControlAPI.pdf -%doc StackwalkerAPI.pdf -%doc SymtabAPI.pdf +%doc docs/dynC_API.pdf +%doc docs/DyninstAPI.pdf +%doc docs/dyninstAPI/examples/ +%doc docs/InstructionAPI.pdf +%doc docs/ParseAPI.pdf +%doc docs/PatchAPI.pdf +%doc docs/ProcControlAPI.pdf +%doc docs/StackwalkerAPI.pdf +%doc docs/SymtabAPI.pdf %files devel %defattr(-,root,root,-) %{_includedir}/dyninst %{_libdir}/dyninst/*.so +%dir %{_libdir}/cmake +%{_libdir}/cmake/Dyninst %files static %defattr(-,root,root,-) @@ -156,12 +180,18 @@ chmod 644 %{buildroot}%{_libdir}/dyninst/testsuite/* %files testsuite %defattr(-,root,root,-) -%{_bindir}/parseThat +#%{_bindir}/parseThat %dir %{_libdir}/dyninst/testsuite/ # Restore the permissions that were hacked out above, during install. %attr(755,root,root) %{_libdir}/dyninst/testsuite/* %changelog +* Mon Oct 20 2014 Josh Stone - 8.2.0-2 +- rhbz1152270: enable bug workaround for syscall pc rewind on ppc + +* Fri Sep 05 2014 Josh Stone - 8.2.0-1 +- rebase to 8.2.0, using upstream tag "v8.2.0.1" + * Mon Feb 10 2014 Josh Stone 8.1.2-6 - rhbz1063447: squash testsuite g++ optimization - rhbz1030969: backported additional patch to silence new warnings