[Cluster-devel] [PATCH] liblogthread, fix fclose race

Christine Caulfield ccaulfie at redhat.com
Thu Aug 28 12:00:50 UTC 2014


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.

Signed-Off-By: Christine Caulfield <ccaulfie at redhat.com>

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


More information about the Cluster-devel mailing list