diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-07-08 06:21:05 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-07-08 06:21:05 +0000 |
commit | 0de175b8d6722cca2221bbb52772f975058ac183 (patch) | |
tree | c83ee5e85562d1c1952d7a86d562ad7fa5808348 | |
parent | 7ef004023510d0c88e1a8bb718ee2848c1358ea4 (diff) | |
download | gcc-0de175b8d6722cca2221bbb52772f975058ac183.zip gcc-0de175b8d6722cca2221bbb52772f975058ac183.tar.gz gcc-0de175b8d6722cca2221bbb52772f975058ac183.tar.bz2 |
Make guality.h handle Yama restricted ptrace mode
guality.exp is silently skipped on Linux systems with
kernel.yama.ptrace_scope=1 because gdb fails to attach to the
sanity check test. This patch uses PR_SET_PTRACER (where available)
to avoid this.
prctl was apparently added in Linux 2.1.57, so I don't think we
need any tests other than __linux for the #include.
2019-07-08 Richard Sandiford <richard.sandiford@arm.com>
gcc/testsuite/
* gcc.dg/guality/guality.h: Include <sys/prctl.h> on Linux targets.
(main): Use PR_SET_PTRACER where available.
From-SVN: r273192
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/guality.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12e5bc1..911dc21 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-08 Richard Sandiford <richard.sandiford@arm.com> + + * gcc.dg/guality/guality.h: Include <sys/prctl.h> on Linux targets. + (main): Use PR_SET_PTRACER where available. + 2019-07-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/91077 diff --git a/gcc/testsuite/gcc.dg/guality/guality.h b/gcc/testsuite/gcc.dg/guality/guality.h index 7a16475..d41327c 100644 --- a/gcc/testsuite/gcc.dg/guality/guality.h +++ b/gcc/testsuite/gcc.dg/guality/guality.h @@ -23,6 +23,9 @@ along with GCC; see the file COPYING3. If not see #include <string.h> #include <stdint.h> #include <unistd.h> +#ifdef __linux +#include <sys/prctl.h> +#endif /* This is a first cut at checking that debug information matches run-time. The idea is to annotate programs with GUALCHK* macros @@ -214,6 +217,10 @@ main (int argc, char *argv[]) int i; char *argv0 = argv[0]; +#if defined(PR_SET_PTRACER_ANY) + prctl (PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); +#endif + guality_gdb_command = getenv ("GUALITY_GDB"); if (!guality_gdb_command) { |