Allow bssl_shim to be ptraced by anyone if waiting for a debugger

On systems with ptrace restrictions, the -wait-for-debugger doesn't
work. Have the shim opt itself out of these restrictions to avoid
complications.

Change-Id: I0bd03effeb90cf6df0cc9931e52d820ea4aad585
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/72448
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc
index 2c70c55..4124178 100644
--- a/ssl/test/bssl_shim.cc
+++ b/ssl/test/bssl_shim.cc
@@ -66,6 +66,10 @@
 #include "test_config.h"
 #include "test_state.h"
 
+#if defined(OPENSSL_LINUX)
+#include <sys/prctl.h>
+#endif
+
 
 #if !defined(OPENSSL_WINDOWS)
 using Socket = int;
@@ -1395,6 +1399,9 @@
     fprintf(stderr, "-wait-for-debugger is not supported on Windows.\n");
     return 1;
 #else
+#if defined(OPENSSL_LINUX)
+    prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
+#endif
     // The debugger will resume the process.
     raise(SIGSTOP);
 #endif