runner: explicitly signal error from handshaker.

When the handshaker fails to parse a config it currently exits. This
causes the two pipes to signal EOF to the shim, but the control channel
is a datagram socket in order to be atomic, thus doesn't signal an
error.

In the shim, EOF on the wfd pipe causes a short loop and thus a hang
forever. Catching the EOF and returning an error doesn't work because
some tests will close the pipe but still return information over the
control channel. We can start a timeout once wfd is closed, but that
seems like it might be flakey.

Thus this change makes the handshaker send an explicit error over the
control channel. It doesn't catch crashes, but it will catch config
errors, which are much more common in cross-version tests.

Change-Id: I4b1afed17694c57e4713d1b0fa4e9ecb12f09ec5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/43865
Reviewed-by: David Benjamin <davidben@google.com>
chromium-5359
Adam Langley 4 years ago committed by Adam Langley
parent aec1b62b07
commit d83dcf58c0
  1. 16
      ssl/test/handshaker.cc

@ -127,13 +127,21 @@ ssize_t write_eintr(int fd, const void *in, size_t len) {
return ret; return ret;
} }
int SignalError() {
const char msg = kControlMsgError;
if (write_eintr(kFdControl, &msg, 1) != 1) {
return 2;
}
return 1;
}
} // namespace } // namespace
int main(int argc, char **argv) { int main(int argc, char **argv) {
TestConfig initial_config, resume_config, retry_config; TestConfig initial_config, resume_config, retry_config;
if (!ParseConfig(argc - 1, argv + 1, &initial_config, &resume_config, if (!ParseConfig(argc - 1, argv + 1, &initial_config, &resume_config,
&retry_config)) { &retry_config)) {
return 2; return SignalError();
} }
const TestConfig *config = initial_config.handshaker_resume const TestConfig *config = initial_config.handshaker_resume
? &resume_config : &initial_config; ? &resume_config : &initial_config;
@ -160,11 +168,7 @@ int main(int argc, char **argv) {
Span<uint8_t> handoff(buf.get(), len); Span<uint8_t> handoff(buf.get(), len);
if (!Handshaker(config, kFdProxyToHandshaker, kFdHandshakerToProxy, handoff, if (!Handshaker(config, kFdProxyToHandshaker, kFdHandshakerToProxy, handoff,
kFdControl)) { kFdControl)) {
char msg = kControlMsgError; return SignalError();
if (write_eintr(kFdControl, &msg, 1) != 1) {
return 3;
}
return 1;
} }
return 0; return 0;
} }

Loading…
Cancel
Save