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/21031] New: pthread_key_delete() race with thread finalization


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

            Bug ID: 21031
           Summary: pthread_key_delete() race with thread finalization
           Product: glibc
           Version: 2.24
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: leo at yuriev dot ru
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

A race condition could occur between the pthread_key_delete() and the
__nptl_deallocate_tsd().

For instance, __nptl_deallocate_tsd() could call a destructor for the key,
immediately before the pthread_key_delete() invalidates it (from an another
thread), and will continue destructor execution after the completion of
pthread_key_delete().

>From a user code this looks as if the corresponding destructor executes after
the key has been removed by pthread_key_delete(), and there is no way to know
whether was destructor called/executed or not.

Suggest add pthread_rwlock_rdlock() for __nptl_deallocate_tsd() and
pthread_rwlock_wrlock() for pthread_key_delete().

-- 
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]