This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/19366] New: returning from a thread should disable cancellation


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

            Bug ID: 19366
           Summary: returning from a thread should disable cancellation
           Product: glibc
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: ninjalj at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 8848
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8848&action=edit
demo of thread acting on cancellation request while terminating

Returning from a thread should behave as calling pthread_exit(), and XSH 2.95,
under the epigraph "Thread Cancellation Cleanup Handlers" requires
pthread_exit() to set the cancellation state and type to disabled and deferred,
respectively.

The attached program is supposed to endlessly loop creating an asynchronously
cancellable thread, and then cancelling and joining it. Instead of that, after
a while, the program exits. This does not happen if the created thread calls
pthread_exit() instead of returning.

Setting the cancellation state and type to disabled and deferred in
nptl/pthread_create.c:START_THREAD_DEFN after returning from/long jumping out
of start_routine fixes this test case. This fix is similar to one in musl
(http://git.musl-libc.org/cgit/musl/commit/?id=36d8e972231c397194e513691d09f7d489de0a62),
the test program deadlocks in musl prior to that commit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]