<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#cccccc" text="#000066">
<font size="+1"><font face="Helvetica, Arial, sans-serif">we have
discovered a fakeroot deadlock, and we've attached a source-patch that
solves the problem at our site.<br>
<br>
the outward manifestation is that <tt><b>faked</b></tt>
& the client (in our case, usually "<tt><b>chown -R ...</b></tt>")
appear to be deadlocked, with faked hanging at listen() and the client
hanging at read().<br>
<br>
adding some debug-output (and writing to /dev/shm/ to cut down on the
timing differences), we discovered that some of the writes from the
client that were not full-length "<tt><b>struct fake_msg</b></tt>"
buffers were being accepted as such.<br>
<br>
this would corrupt the stream, and everything later in the stream would
be off.<br>
<br>
the cascading problem would be that <tt>process_msg()</tt>
would get values for functions to call that were out of bounds and skip
them entirely.  the final result would be that the client would finish
sending messages for which it expected replies, and faked would have
thrown all of its messages away as invalid, and go back to listening
for more.<br>
<br>
the attached patch, when applied, should be pretty self-explanatory: 
if the size of the buffer read is not of the appropriate size, then
continue back to the top of the loop and get just enough more from the
read to fill the buffer.<br>
<br>
this solves the problem for us.<br>
<br>
let us know if you need any further details, or what we might do in
order to help properly get this patch into a place where it can be
distributed.<br>
<br>
++ kirk beitz<br>
</font></font>
<br>
</body>
</html>