Testsuite docs: explain ptrace_scope and core_pattern requirements.

Message ID 55BB5EF0.7040106@gmail.com
State New, archived
Headers

Commit Message

Ciro Santilli July 31, 2015, 11:41 a.m. UTC
  From 526bde3e1716a13406f9343ff6a788da9e553e6d Mon Sep 17 00:00:00 2001
From: Ciro Santilli <ciro.santilli@gmail.com>
Date: Fri, 31 Jul 2015 10:05:53 +0200
Subject: [PATCH] Testsuite docs: explain ptrace_scope and core_pattern
  requirements.

ptrace_scope can break all attach related tests.

core_pattern can break bigcore.exp.

2015-07-31  Ciro Santilli  <ciro.santilli@gmail.com>

gdb:

	PR testsuite/18067
	PR testsuite/18704
	* README (GDB Testsuite): Explain ptrace_scope and core_pattern.
	Make section more succinct.
	Remove broken Red Hat DejaGNU FTP link.
---
  gdb/README | 35 ++++++++++++++++++++++++++---------
  1 file changed, 26 insertions(+), 9 deletions(-)
  

Comments

Simon Marchi July 31, 2015, 1:35 p.m. UTC | #1
On 15-07-31 07:41 AM, Ciro Santilli wrote:
>  From 526bde3e1716a13406f9343ff6a788da9e553e6d Mon Sep 17 00:00:00 2001
> From: Ciro Santilli <ciro.santilli@gmail.com>
> Date: Fri, 31 Jul 2015 10:05:53 +0200
> Subject: [PATCH] Testsuite docs: explain ptrace_scope and core_pattern
>   requirements.
> 
> ptrace_scope can break all attach related tests.
> 
> core_pattern can break bigcore.exp.
> 
> 2015-07-31  Ciro Santilli  <ciro.santilli@gmail.com>
> 
> gdb:
> 
> 	PR testsuite/18067
> 	PR testsuite/18704
> 	* README (GDB Testsuite): Explain ptrace_scope and core_pattern.
> 	Make section more succinct.
> 	Remove broken Red Hat DejaGNU FTP link.
> ---
>   gdb/README | 35 ++++++++++++++++++++++++++---------
>   1 file changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/gdb/README b/gdb/README
> index d485536..87a4a5f 100644
> --- a/gdb/README
> +++ b/gdb/README
> @@ -595,15 +595,32 @@ think you will be ready to submit the patches.
>   GDB Testsuite
>   =============
> 
> -   Included with the GDB distribution is a DejaGNU based testsuite
> -that can either be used to test your newly built GDB, or for
> -regression testing a GDB with local modifications.
> -
> -   Running the testsuite requires the prior installation of DejaGNU,
> -which is generally available via ftp.  The directory
> -ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot.
> -Once DejaGNU is installed, you can run the tests in one of the
> -following ways:
> +Requirements:
> +
> +*   DejaGNU
> +
> +*   Ability to attach to processes with the same UID.
> +
> +    In Linux, you need either to ensure that ptrace is allowed with:
> +
> +        echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
> +
> +    or sudo, which is a bad idea.
> +
> +*   Ability to generate big sparse core files.
> +
> +    In Linux, this is done by default, but it may be broken if your
> +    distribution sets:
> +
> +        /proc/sys/kernel/core_pattern
> +
> +    to something starting with `|` to use a custom handler program.
> +
> +    You can fix that with:
> +
> +        echo | sudo tee /proc/sys/kernel/core_pattern
> +
> +Usage:
> 
>     (1)	cd gdb-VERSION
>   	make check-gdb

More generally, would it be good to modify the tests that break when ptrace_scope != 0
so that they xfail or report unsupported?  We could easily read the value of ptrace_scope
both in native and remote.
  
Ciro Santilli July 31, 2015, 2:03 p.m. UTC | #2
We could do that as well, I will take a look at it.

But I'd rather check if "can we attach to another process" by trying
it out directly rather than reading `ptrace_scope`.

For example, direct ptrace_scope check could XFAIL falsely if the user
is running with sudo, and there may be more variables that come into
play.

On Fri, Jul 31, 2015 at 3:35 PM, Simon Marchi <simon.marchi@ericsson.com> wrote:
> On 15-07-31 07:41 AM, Ciro Santilli wrote:
>>  From 526bde3e1716a13406f9343ff6a788da9e553e6d Mon Sep 17 00:00:00 2001
>> From: Ciro Santilli <ciro.santilli@gmail.com>
>> Date: Fri, 31 Jul 2015 10:05:53 +0200
>> Subject: [PATCH] Testsuite docs: explain ptrace_scope and core_pattern
>>   requirements.
>>
>> ptrace_scope can break all attach related tests.
>>
>> core_pattern can break bigcore.exp.
>>
>> 2015-07-31  Ciro Santilli  <ciro.santilli@gmail.com>
>>
>> gdb:
>>
>>       PR testsuite/18067
>>       PR testsuite/18704
>>       * README (GDB Testsuite): Explain ptrace_scope and core_pattern.
>>       Make section more succinct.
>>       Remove broken Red Hat DejaGNU FTP link.
>> ---
>>   gdb/README | 35 ++++++++++++++++++++++++++---------
>>   1 file changed, 26 insertions(+), 9 deletions(-)
>>
>> diff --git a/gdb/README b/gdb/README
>> index d485536..87a4a5f 100644
>> --- a/gdb/README
>> +++ b/gdb/README
>> @@ -595,15 +595,32 @@ think you will be ready to submit the patches.
>>   GDB Testsuite
>>   =============
>>
>> -   Included with the GDB distribution is a DejaGNU based testsuite
>> -that can either be used to test your newly built GDB, or for
>> -regression testing a GDB with local modifications.
>> -
>> -   Running the testsuite requires the prior installation of DejaGNU,
>> -which is generally available via ftp.  The directory
>> -ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot.
>> -Once DejaGNU is installed, you can run the tests in one of the
>> -following ways:
>> +Requirements:
>> +
>> +*   DejaGNU
>> +
>> +*   Ability to attach to processes with the same UID.
>> +
>> +    In Linux, you need either to ensure that ptrace is allowed with:
>> +
>> +        echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
>> +
>> +    or sudo, which is a bad idea.
>> +
>> +*   Ability to generate big sparse core files.
>> +
>> +    In Linux, this is done by default, but it may be broken if your
>> +    distribution sets:
>> +
>> +        /proc/sys/kernel/core_pattern
>> +
>> +    to something starting with `|` to use a custom handler program.
>> +
>> +    You can fix that with:
>> +
>> +        echo | sudo tee /proc/sys/kernel/core_pattern
>> +
>> +Usage:
>>
>>     (1)       cd gdb-VERSION
>>       make check-gdb
>
> More generally, would it be good to modify the tests that break when ptrace_scope != 0
> so that they xfail or report unsupported?  We could easily read the value of ptrace_scope
> both in native and remote.
  

Patch

diff --git a/gdb/README b/gdb/README
index d485536..87a4a5f 100644
--- a/gdb/README
+++ b/gdb/README
@@ -595,15 +595,32 @@  think you will be ready to submit the patches.
  GDB Testsuite
  =============

-   Included with the GDB distribution is a DejaGNU based testsuite
-that can either be used to test your newly built GDB, or for
-regression testing a GDB with local modifications.
-
-   Running the testsuite requires the prior installation of DejaGNU,
-which is generally available via ftp.  The directory
-ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot.
-Once DejaGNU is installed, you can run the tests in one of the
-following ways:
+Requirements:
+
+*   DejaGNU
+
+*   Ability to attach to processes with the same UID.
+
+    In Linux, you need either to ensure that ptrace is allowed with:
+
+        echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
+
+    or sudo, which is a bad idea.
+
+*   Ability to generate big sparse core files.
+
+    In Linux, this is done by default, but it may be broken if your
+    distribution sets:
+
+        /proc/sys/kernel/core_pattern
+
+    to something starting with `|` to use a custom handler program.
+
+    You can fix that with:
+
+        echo | sudo tee /proc/sys/kernel/core_pattern
+
+Usage:

    (1)	cd gdb-VERSION
  	make check-gdb