Skip to contentSkip to conversation

liblogthread, fix fclose race

PATCH New Christine Caulfield 1 participant 1 message Aug 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 liblogthread, fix fclose race

The mutex in liblogthread protects the list of messages to be printed, but not the FILE*. So the printing thread gets the mutex, takes the entries off the list and then releases it before doing the printing.

It's quite possible that the FILE* has been freed by the calling daemon in this gap, thus causing a daemon segfault when the message comes to be printed

The fclose/fopen code is already protected by the mutex so it seems to be a simple matter of moving the phthread_mutex_unlock() a little later in the print loop.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: logt_race_stable3.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20140828/de0cdb6e/attachment.bin>