vlog: Avoid calling worker_request() reentrantly.
authorBen Pfaff <blp@nicira.com>
Fri, 11 Jan 2013 01:14:03 +0000 (17:14 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 11 Jan 2013 04:04:04 +0000 (20:04 -0800)
commita3c7f20d87e415b9241ab6e51b110b82d9ef8348
treeb73193d024f93d9c7b9d6795195927d9ec5947b3
parenta83609852178ad25902fbb80e7647a924d437ab7
vlog: Avoid calling worker_request() reentrantly.

The following call stack was possible:

    vlog
        -> worker_request()
            -> poll_block()
                -> vlog
                     -> worker_request()

which caused problems because worker_request() is not reentrant.  In a
little more detail, the second worker_request() shoves its RPC protocol
data into the middle of the first.  This means that, first, you get
some binary crud in the log (the header for the second RPC).  And,
second, text from the first RPC log message gets treated by the worker
as the subsequent RPC's header.  That, in turn, typically causes the
worker to try to xmalloc() a huge number of bytes (0x20000000 or more,
since "space" has ASCII value 0x20), which causes the worker to die
with "virtual memory exhausted".  The main process then dies because
the worker's death closes the socket it uses to communicate with it
("connection reset").

Bug #14616.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
lib/vlog.c