public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch+8.0.1] Fix T-stopped detach regression on old kernels
@ 2017-08-30 19:14 Jan Kratochvil
  2017-08-31 22:18 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2017-08-30 19:14 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hi,

https://sourceware.org/bugzilla/show_bug.cgi?id=22046

On <=RHEL6 hosts Fedora/RHEL GDB started to 'kill -STOP' all processes it detached.  Even those not originally T-stopped.  This is a Fedora-specific patch which is based on upstream GDB's PROC_STATE_STOPPED state.

I believe (I did not verify) this patch did regress it:
commit d617208bb06bd461b52ce041d89f7127e3044762
Author: Pedro Alves <palves@redhat.com>
Date:   Mon Jul 25 12:42:17 2016 +0100   
    linux-procfs: Introduce enum proc_state

As originally there was strstr() but now there is strcmp() and so the missing trailing '\n' no longer matches.

The Bug was found by Michal Kolar.

Reproducibility:
$ gdb -p $PID
(gdb) quit
$ ...

Actual results:
===
RHEL6.9 x86_64 # scl enable devtoolset-7 bash
RHEL6.9 x86_64 # which gdb
/opt/rh/devtoolset-7/root/usr/bin/gdb
RHEL6.9 x86_64 # ./testcase.sh
24737 pts/0    S+     0:00 /bin/sleep 4
24737 pts/0    T+     0:00 /bin/sleep 4
RHEL6.9 x86_64 #
===

Expected results:
===
RHEL6.9 x86_64 # which gdb
/usr/bin/gdb
RHEL6.9 x86_64 # ./testcase.sh
24708 pts/0    S+     0:00 /bin/sleep 4
24708 pts/0    S+     0:00 /bin/sleep 4
./testcase.sh: line 20: kill: (24708) - No such process
RHEL6.9 x86_64 #
===

Tested: 5b86dbf4549af98c4428da4764182e03f22c58ab

OK for check-in?


Jan

[-- Attachment #2: el6-stop2.patch --]
[-- Type: text/plain, Size: 793 bytes --]

2017-08-30  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* nat/linux-procfs.c (parse_proc_status_state): Fix PROC_STATE_STOPPED
	detection.

diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index a12f6228cb..cca35cbf1d 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -104,10 +104,10 @@ parse_proc_status_state (const char *state)
       return PROC_STATE_TRACING_STOP;
     case 'T':
       /* Before Linux 2.6.33, tracing stop used uppercase T.  */
-      if (strcmp (state, "T (tracing stop)") == 0)
-	return PROC_STATE_TRACING_STOP;
-      else
+      if (strcmp (state, "T (stopped)\n") == 0)
 	return PROC_STATE_STOPPED;
+      else /* "T (tracing stop)\n" */
+	return PROC_STATE_TRACING_STOP;
     case 'X':
       return PROC_STATE_DEAD;
     case 'Z':

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch+8.0.1] Fix T-stopped detach regression on old kernels
  2017-08-30 19:14 [patch+8.0.1] Fix T-stopped detach regression on old kernels Jan Kratochvil
@ 2017-08-31 22:18 ` Pedro Alves
  2017-09-01  4:23   ` [commit+8.0.1] " Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2017-08-31 22:18 UTC (permalink / raw)
  To: Jan Kratochvil, gdb-patches

On 08/30/2017 09:14 PM, Jan Kratochvil wrote:
> Hi,

Hi.

> 
> OK for check-in?

OK.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [commit+8.0.1] Fix T-stopped detach regression on old kernels
  2017-08-31 22:18 ` Pedro Alves
@ 2017-09-01  4:23   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2017-09-01  4:23 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri, 01 Sep 2017 00:18:46 +0200, Pedro Alves wrote:
> On 08/30/2017 09:14 PM, Jan Kratochvil wrote:
> > OK for check-in?
> 
> OK.

5c811d30d12b6f7c6c6f4ce6d03408d987154548 master
c247e38d78a98f85066e4a61032ee742d08a0579 gdb-8.0-branch


Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-01  4:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 19:14 [patch+8.0.1] Fix T-stopped detach regression on old kernels Jan Kratochvil
2017-08-31 22:18 ` Pedro Alves
2017-09-01  4:23   ` [commit+8.0.1] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).