Bug 427860 - Race while attaching to a stopped process
Summary: Race while attaching to a stopped process
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-07 22:01 UTC by Jan Kratochvil
Modified: 2008-04-15 19:59 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-04-15 19:59:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Testcase. (2.64 KB, text/plain)
2008-01-07 22:01 UTC, Jan Kratochvil
no flags Details

Description Jan Kratochvil 2008-01-07 22:01:42 UTC
Description of problem:
The current attaching code implemented since GDB 6.6-27 may have a race.

Version-Release number of selected component (if applicable):
gdb-6.6-27.fc8

How reproducible:
Sparsely.

Steps to Reproduce:
1. gcc -o signalgdb signalgdb.c -Wall -ggdb2
2. ./signalgdb

Actual results:
status=0x137f
signalgdb: signalgdb.c:95: main: Assertion `((((__extension__ ({ union {
__typeof(status) __in; int __i; } __u; __u.__in = (status); __u.__i; }))) &
0xff00) >> 8) == 18' failed.

Expected results:
Endless silent run.

Additional info:
It fails depending on some scheduling mood - sometimes it runs millions cycles
fine and sometimes it aborts in the first loop.
It gets signal SIGSTOP instead of expected SIGCONT.
Abort reproduced on vanilla-2.6.22-rc4-git7.x86_64.
It seems quickly unreproducible on kernel-2.6.23.8-63.fc8.x86_64.

This testcase emulates the current Rawhide GDB's behavior as implemented since
gdb-6.6-27.fc8:

* Mon Sep 17 2007 Jan Kratochvil <jan.kratochvil> - 6.6-27
- Fix attaching to stopped processes and/or pending signals.

Unfortunately there is a race for already Stopped processes; this
Comment/Testcase could be submitted as a GDB bug instead.  The Stopped process
being attached to by GDB may "run a bit" despite it during the attachment
operation.

This note comes from: Bug 244162 Comment 17

Comment 1 Jan Kratochvil 2008-01-07 22:01:43 UTC
Created attachment 291020 [details]
Testcase.

Comment 2 Jan Kratochvil 2008-04-15 19:59:55 UTC
Problem is no longer present in the patch proposed by Daniel J. upstream:
  http://sourceware.org/ml/gdb-patches/2008-04/msg00224.html



Note You need to log in before you can comment on or make changes to this bug.