Use PR_SET_PTRACER only if defined
authorMarcin Cieslak <saper@saper.info>
Sat, 13 Jun 2015 16:25:42 +0000 (16:25 +0000)
committerMarcin Cieslak <saper@saper.info>
Sat, 13 Jun 2015 16:37:10 +0000 (16:37 +0000)
This feature has been introduced in Linux 3.4,
older kernels do have prctl(2) but know
PR_SET_PTRACER not.

mono/mini/mini-exceptions.c

index afc0245a4b1e401eb410b77f6b1cd8d795f1b3ae..c43da613f60e1eba364a30e409baef5541ccdeab 100644 (file)
@@ -2218,7 +2218,7 @@ mono_handle_native_sigsegv (int signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *i
                 * it will deadlock. Call the syscall directly instead.
                 */
                pid = mono_runtime_syscall_fork ();
-#if defined (__linux__) && defined (HAVE_PRCTL)
+#if defined (HAVE_PRCTL) && defined(PR_SET_PTRACER)
                if (pid > 0) {
                        // Allow gdb to attach to the process even if ptrace_scope sysctl variable is set to
                        // a value other than 0 (the most permissive ptrace scope). Most modern Linux