ab4bc8a
summary: Test for bz522528 (pthread_join() hangs if a thread calls setuid())
ab4bc8a
description: |
ab4bc8a
    Bug summary: pthread_join() hangs if a thread calls setuid()
ab4bc8a
    Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=522528
ab4bc8a
ab4bc8a
    Description:
ab4bc8a
ab4bc8a
    Created an attachment (id=360523)
ab4bc8a
    reproducer's source file
ab4bc8a
ab4bc8a
    Description of problem:
ab4bc8a
ab4bc8a
    When a program creates a thread which calls setuid() and terminates, the other
ab4bc8a
    thread trying to wait for it hangs.
ab4bc8a
ab4bc8a
ab4bc8a
    Version-Release number of selected component (if applicable):
ab4bc8a
ab4bc8a
    RHEL5 (2.5-34), also RHEL4 and the newest upstream sources
ab4bc8a
ab4bc8a
ab4bc8a
    How reproducible:
ab4bc8a
ab4bc8a
    always
ab4bc8a
ab4bc8a
ab4bc8a
    Steps to Reproduce:
ab4bc8a
ab4bc8a
    1. Compile attached source file of reproducer:
ab4bc8a
ab4bc8a
    $ gcc -o reproducer reproducer.c -lpthread
ab4bc8a
ab4bc8a
    2. and run it:
ab4bc8a
ab4bc8a
    $ ./reproducer
ab4bc8a
ab4bc8a
      
ab4bc8a
    Actual results:
ab4bc8a
ab4bc8a
    program hangs
ab4bc8a
ab4bc8a
ab4bc8a
    Expected results:
ab4bc8a
ab4bc8a
    program should end without hanging
ab4bc8a
ab4bc8a
ab4bc8a
    Additional info:
ab4bc8a
ab4bc8a
    This bug has appeared quite a long ago, you can find it in a sourceware BZ with existing patch at:
ab4bc8a
ab4bc8a
    http://sources.redhat.com/bugzilla/show_bug.cgi?id=3270#c2
ab4bc8a
ab4bc8a
    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.
ab4bc8a
ab4bc8a
    There is also existing BZ for RHEL4:
ab4bc8a
ab4bc8a
    https://bugzilla.redhat.com/show_bug.cgi?id=248671
ab4bc8a
contact: Petr Muller <pmuller@redhat.com>
ab4bc8a
component:
ab4bc8a
  - glibc
ab4bc8a
test: ./runtest.sh
ab4bc8a
framework: beakerlib
ab4bc8a
recommend:
ab4bc8a
  - gcc
3c29e12
tag:
3c29e12
  - simple
3c29e12
  - tier1_mfranc
3c29e12
  - mfranc_stable
3c29e12
  - noEWA
3c29e12
  - Tier1
3c29e12
  - not-er15271
3c29e12
  - glibc-buildroot-ready
ab4bc8a
duration: 75m
ab4bc8a
link:
ab4bc8a
  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=522528
ab4bc8a
extra-summary: /tools/glibc/Regression/bz522528-pthread-join-hangs-if-a-thread-calls-setuid
ab4bc8a
extra-task: /tools/glibc/Regression/bz522528-pthread-join-hangs-if-a-thread-calls-setuid