Bug 522528 - pthread_join() hangs if a thread calls setuid()
Summary: pthread_join() hangs if a thread calls setuid()
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc
Version: 5.3
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Andreas Schwab
QA Contact: BaseOS QE
Depends On:
TreeView+ depends on / blocked
Reported: 2009-09-10 15:42 UTC by Martin Osvald
Modified: 2010-03-30 09:05 UTC (History)
4 users (show)

Fixed In Version: glibc-2.5-44
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-03-30 09:05:11 UTC
Target Upstream Version:

Attachments (Terms of Use)
reproducer's source file (535 bytes, text/plain)
2009-09-10 15:42 UTC, Martin Osvald
no flags Details
a patch which fixes the bug (5.14 KB, patch)
2009-09-10 15:46 UTC, Martin Osvald
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0306 normal SHIPPED_LIVE glibc bug fix and enhancement update 2010-03-29 14:34:54 UTC
Sourceware 3270 'P2' 'RESOLVED' 'Setuid implementation has races and lockups' 2019-11-18 07:23:21 UTC

Description Martin Osvald 2009-09-10 15:42:35 UTC
Created attachment 360523 [details]
reproducer's source file

Description of problem:

When a program creates a thread which calls setuid() and terminates, the other
thread trying to wait for it hangs.

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

RHEL5 (2.5-34), also RHEL4 and the newest upstream sources

How reproducible:


Steps to Reproduce:

1. Compile attached source file of reproducer:

$ gcc -o reproducer reproducer.c -lpthread

2. and run it:

$ ./reproducer

Actual results:

program hangs

Expected results:

program should end without hanging

Additional info:

This bug has appeared quite a long ago, you can find it in a sourceware BZ with existing patch at:


The patch solves the problem, but I have no idea why this hasn't been applied in the upstream already. I have attached a slightly modiffied version of the patch to be able to be applied and built on RHEL5 glibc sources and it works and solves the problem.

There is also existing BZ for RHEL4:


Comment 1 Martin Osvald 2009-09-10 15:46:24 UTC
Created attachment 360525 [details]
a patch which fixes the bug

this is a slightly modified version of the original patch: http://sources.redhat.com/bugzilla/attachment.cgi?id=1330&action=view

Comment 4 Andreas Schwab 2009-11-05 12:55:23 UTC

*** This bug has been marked as a duplicate of bug 491995 ***

Comment 9 errata-xmlrpc 2010-03-30 09:05:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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