[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] did 'nbd-server -d' accidentally break?



> On 14 Dec 2016, at 22:43, Eric Blake <eblake@...696...> wrote:
> 
> I don't see how it can be reliable:
> 
> static void
> handle_modern_connection(GArray *const servers, const int sock, struct
> generic_conf *genconf)
> {
> ...
> 	int commsocket;
> ...
>        if (!dontfork) {
>                pid = spawn_child(&commsocket);
> ...
> 	}
> ...
>        client = negotiate(net, servers, genconf);
>        if (!client) {
>                msg(LOG_ERR, "Modern initial negotiation failed");
>                goto handler_err;
>        }
> 	len = strlen(client->server->servename);
> 	writeit(commsocket, &len, sizeof len);
> 	writeit(commsocket, client->server->servename, len);
> 	readit(commsocket, &acl, 1);
> 	close(commsocket);
> 
> Since -d turns dontfork on, it means commsocket is uninitialized(!). If
> you're lucky, it starts life as 0, and if you are in an interactive
> environment (where stdin happens to be a tty), then the output goes
> somewhere rather than causing an error, and then you have to type
> something other than N or X to get the readit() to succeed.
> 
> Looks like commit 7e901617 is the culprit, and maybe the solution is to
> just skip the commsocket stuff when -d is active (should -d also imply
> maxconnections of 1?).

Ah. Apologies for reading your emails out of order. This is the
other part of the writezeroes patch you used. However, as expressed
there it seemed to turn of ACL checking. Why do we need that bit?

--
Alex Bligh




Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Reply to: