Bug 169838

Summary: pthread_kill(pthread_self) returns ESRCH
Product: [Fedora] Fedora Reporter: Alexandra Kossovsky <alexandra.kossovsky>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-04 11:17:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test case mentioned in the bug description none

Description Alexandra Kossovsky 2005-10-04 11:02:53 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

Description of problem:
in NPTL, pthread_self may be incorrect after two forks

Version-Release number of selected component (if applicable):
glibc-2.3.5-10

How reproducible:
Always

Steps to Reproduce:
1. get a C file which I'll attach
2. compile it and run
3. find that pthread_kill(pthread_self(), SIGPIPE) returns ESRCH
  

Actual Results:  I see following output of the program:
1st thread b7e8ebb0, second b7e8ebb0
kill returned 3
pthread_join returned 0
(Note that kill returned 3!)

Expected Results:  I expect the same output as it is with only one fork():
1st thread b7e8ebb0, second b7e8ebb0
kill returned 0
pthread_join returned 0


Additional info:

Comment 1 Alexandra Kossovsky 2005-10-04 11:04:21 UTC
Created attachment 119583 [details]
test case mentioned in the bug description

Comment 2 Jakub Jelinek 2005-10-04 11:17:30 UTC
This testcase is invalid.
http://www.opengroup.org/onlinepubs/009695399/functions/fork.html
"If a multi-threaded process calls fork()," ...
"the child process may only execute async-signal-safe operations
 until such time as one of the exec functions is called."
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
None of pthread_create, pthread_self, printf, pthread_join or exit (implicit
after return 0 from main) are async-signal-safe.