Conditionally define PTRACE_O_EXITKILL in

On older Linux distributions (e.g. Centos 7 which we still use for
Conscrypt releases) PTRACE_O_EXITKILL is defined in <linux/ptrace.h>
but this can't be included alongside <sys/ptrace.h> due to conflicting
defines, so this is the path of least resistance for portability.

Could also define this as 0 if undefined, but all distributions seem
to use 1<<20, and Centos 7 kernels should have support as they are 3.10
and later and PTRACE_O_EXITKILL was introduced around 3.8.

Change-Id: Ib8a6e0dbc62613e30c38a6cc09522c2d7b92577b
Reviewed-by: Adam Langley <>
diff --git a/crypto/fipsmodule/rand/ b/crypto/fipsmodule/rand/
index 5935aaf..1119778 100644
--- a/crypto/fipsmodule/rand/
+++ b/crypto/fipsmodule/rand/
@@ -29,6 +29,10 @@
 #include <sys/syscall.h>
 #include <sys/user.h>
+#if !defined(PTRACE_O_EXITKILL)
+#define PTRACE_O_EXITKILL (1 << 20)
 #if defined(OPENSSL_NO_ASM)
 static int have_rdrand() { return 0; }