Merge pull request #226 from janbbeck/master

Change Linux PIN version to 3.7 and fix bug in PIN tracer
This commit is contained in:
George Hotz 2019-06-17 12:37:04 -07:00 committed by GitHub
commit 63fef0bc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -193,9 +193,9 @@ static inline void mmap_close(MMAPFILE fd) {
close(fd);
}
static void *mmap_map(MMAPFILE fd, size_t size, size_t offset = 0) {
struct stat st;
fstat(fd, &st);
if(static_cast<size_t>(st.st_size) < offset+size)
USIZE thesize=0;
OS_FileSizeFD(fd,&thesize);
if(static_cast<size_t>(thesize) < offset+size)
ftruncate(fd, offset+size);
void *ret = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset);
@ -442,7 +442,7 @@ public:
#ifndef TARGET_WINDOWS
void fork_before(THREADID tid) {
PIN_GetLock(&lock, 0);
sync();
// sync(); // commented out to be compatible with later PIN versions. Seems to work...
// TODO: Close all files, reopen later
// I think this is only required for the current tid's data structure.
}
@ -650,6 +650,11 @@ VOID Instruction(INS ins, VOID *v) {
// TODO: Bitch at the PIN folks.
return;
}
if(INS_Mnemonic(ins) == "XSAVEC") {
// Avoids "Cannot use IARG_MEMORYWRITE_SIZE on non-standard memory access of instruction at 0xfoo: xsavec ptr [rsp]"
// TODO: Bitch at the PIN folks.
return;
}
for(UINT32 i = 0; i < memOps; i++) {
if(!filtered && INS_MemoryOperandIsRead(ins, i)) {
@ -969,4 +974,3 @@ int main(int argc, char *argv[]) {
process_state.init(PIN_GetPid());
PIN_StartProgram(); // Note that this unwinds the stack!
}

View File

@ -5,14 +5,14 @@ cd "$(dirname "$0")/pin"
case "`uname`" in
Linux)
if test -d pin-latest; then true; else
curl -L https://software.intel.com/sites/landingpage/pintool/downloads/pin-2.14-71313-gcc.4.4.7-linux.tar.gz | tar xz
ln -s pin-2.14-71313-gcc.4.4.7-linux pin-latest
curl -L https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.7-97619-g0d0c92f4f-gcc-linux.tar.gz | tar xz
ln -s pin-3.7-97619-g0d0c92f4f-gcc-linux pin-latest
fi
# pin build deps, good?
if which apt-get; then
echo "apt-getting pin tool building deps"
sudo apt-get -qq -y install g++-4.9 gcc-4.9-multilib g++-4.9-multilib || echo "WARNING: apt-get failed"
sudo apt-get -qq -y install g++-7 gcc-7-multilib g++-7-multilib || echo "WARNING: apt-get failed"
else
echo "WARNING: you don't have apt-get, you are required to fetch pin tool building deps (e.g. 32 bit libs) on your own"
fi