Conditionally define PTRACE_O_EXITKILL in urandom_test.cc 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-on: https://boringssl-review.googlesource.com/c/boringssl/+/38704 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/rand/urandom_test.cc b/crypto/fipsmodule/rand/urandom_test.cc index 5935aaf..1119778 100644 --- a/crypto/fipsmodule/rand/urandom_test.cc +++ b/crypto/fipsmodule/rand/urandom_test.cc
@@ -29,6 +29,10 @@ #include <sys/syscall.h> #include <sys/user.h> +#if !defined(PTRACE_O_EXITKILL) +#define PTRACE_O_EXITKILL (1 << 20) +#endif + #if defined(OPENSSL_NO_ASM) static int have_rdrand() { return 0; } #endif