I'm testing an antidebug solution with ptrace
method
int main(int argc, char **argv) {
void *handle;
long (*go)(enum __ptrace_request request, pid_t pid);
// get a handle to the library that contains 'ptrace'
handle = dlopen ("libc.so", RTLD_LAZY);
// reference to the dynamically-resolved function 'ptrace'
go = dlsym(handle, "ptrace");
if (go(PTRACE_TRACEME, 0) < 0) {
puts("being traced");
exit(1);
}
puts("not being traced");
// cleanup
dlclose(handle);
return 0;
}
When I execute it, I'm always getting a stopped error,
# ./a.out
not being traced
[4]+ Stopped ./a.out
Then I tried to add the SIGSTOP handler like this
int main(int argc, char **argv) {
signal(SIGSTOP, SIG_IGN);
And it's still getting a stopped error, any ideas?