File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 26
26
#include < sys/resource.h>
27
27
#include < unistd.h>
28
28
#include < stdlib.h> // atoi
29
+ #include < sys/prctl.h>
29
30
#ifndef ANDROID // no Android impl
30
31
# include < ucontext.h>
31
32
#endif
@@ -44,6 +45,13 @@ static unsigned int _gdb_sleep_duration = 300;
44
45
#define CRAWL_STACK_ON_SIGSEGV
45
46
#endif
46
47
48
+ #ifndef PR_SET_PTRACER
49
+ #define PR_SET_PTRACER 0x59616d61
50
+ #endif
51
+ #ifndef PR_SET_PTRACER_ANY
52
+ #define PR_SET_PTRACER_ANY ((unsigned long )-1 )
53
+ #endif
54
+
47
55
#if defined(CRAWL_STACK_ON_SIGSEGV)
48
56
49
57
#include < unistd.h>
@@ -87,6 +95,9 @@ ah_crap_handler(int signum)
87
95
_progname,
88
96
getpid ());
89
97
98
+ // Allow us to be ptraced by gdb on Linux with Yama restrictions enabled.
99
+ prctl (PR_SET_PTRACER, PR_SET_PTRACER_ANY);
100
+
90
101
sleep (_gdb_sleep_duration);
91
102
92
103
printf (" Done sleeping...\n " );
You can’t perform that action at this time.
0 commit comments