Skip to content

Commit

Permalink
arm64 remove SYSCALL_EXIT_BREAKPOINT define and the DSIABLE_POSTONE code
Browse files Browse the repository at this point in the history
  • Loading branch information
Itaru Kitayama committed Dec 10, 2016
1 parent d3a2aae commit 633389d
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions proccontrol/src/linux.C
Expand Up @@ -101,9 +101,6 @@ using namespace ProcControlAPI;
#define PTRACE_SETREGS PPC_PTRACE_SETREGS
#endif

#if defined(arch_aarch64)
#define SYSCALL_EXIT_BREAKPOINT
#endif

static pid_t P_gettid();
static bool t_kill(int pid, int sig);
Expand Down Expand Up @@ -501,59 +498,16 @@ bool DecoderLinux::decode(ArchEvent *ae, std::vector<Event::ptr> &events)
break;
}
}
/*
* aarch64 notes:
* Due to arm kenel bug, if tracer continues the tracee with PTRACE_SYSCALL,
* the kernel doesn't check the changed flags again before exiting.
* Hence, I assume syscalls exit quietly and normally.
* And move the code for exit stop here.
* "Postpone" is actually "postponed" below.
*/
#if defined(arch_aarch64)
#define DISABLE_POSTPONE
#endif

#if defined(DISABLE_POSTPONE)
#if defined(SYSCALL_EXIT_BREAKPOINT)
#undef DISABLE_POSTPONE
#endif
#endif

if (postpone) {
archevent->event_ext = ext;

#if !defined(DISABLE_POSTPONE)
pthrd_printf("Postponing event until syscall exit on %d/%d\n",
proc->getPid(), thread->getLWP());
event = Event::ptr(new EventPostponedSyscall());
lthread->postponeSyscallEvent(archevent);
archevent = NULL;

#else //disable postpone
pthrd_printf("ARM-warning: syscall is not postponed on %d/%d.\n",
proc->getPid(), thread->getLWP() );

switch (ext) {
case PTRACE_EVENT_FORK:
case PTRACE_EVENT_CLONE:
pthrd_printf("Handle %s event after syscall enter on %d/%d\n",
ext == PTRACE_EVENT_FORK ? "fork" : "clone",
proc->getPid(), thread->getLWP());
if (!archevent->findPairedEvent(parent, child)) {
pthrd_printf("Parent half of paired event, postponing decode "
"until child arrives\n");
archevent->postponePairedEvent();
return true;
}
break;
case PTRACE_EVENT_EXEC:
pthrd_printf("Resuming exec event after syscall exit on %d/%d\n",
proc->getPid(), thread->getLWP());
event = Event::ptr(new EventExec(EventType::Post));
event->setSyncType(Event::sync_process);
break;
}
#endif
}
break;
}
Expand Down Expand Up @@ -581,40 +535,6 @@ bool DecoderLinux::decode(ArchEvent *ae, std::vector<Event::ptr> &events)
}
adjusted_addr = adjustTrapAddr(addr, proc->getTargetArch());

// handle the fake syscall exit stop bp.
#if defined(SYSCALL_EXIT_BREAKPOINT)
if( lthread->addr_fakeSyscallExitBp == adjusted_addr
&& lthread->isSet_fakeSyscallExitBp){
//do the same as syscall_exit_stop signal
if (lthread->hasPostponedSyscallEvent()) {
delete archevent;
archevent = lthread->getPostponedSyscallEvent();
ext = archevent->event_ext;
switch (ext) {
case PTRACE_EVENT_FORK:
case PTRACE_EVENT_CLONE:
pthrd_printf("Resuming %s event after syscall exit on %d/%d\n",
ext == PTRACE_EVENT_FORK ? "fork" : "clone",
proc->getPid(), thread->getLWP());
if (!archevent->findPairedEvent(parent, child)) {
pthrd_printf("Parent half of paired event, postponing decode "
"until child arrives\n");
archevent->postponePairedEvent();
return true;
}
break;
case PTRACE_EVENT_EXEC:
pthrd_printf("Resuming exec event after syscall exit on %d/%d\n",
proc->getPid(), thread->getLWP());
event = Event::ptr(new EventExec(EventType::Post));
event->setSyncType(Event::sync_process);
break;
}
break;
}
}
#endif

if (rpcMgr()->isRPCTrap(thread, adjusted_addr)) {
pthrd_printf("Decoded event to rpc completion on %d/%d at %lx\n",
proc->getPid(), thread->getLWP(), adjusted_addr);
Expand Down

0 comments on commit 633389d

Please sign in to comment.