clock_gettime(CLOCK_REALTIME, &now);
timespec_diff(&deadline, &now, &timeout);
- if (timeout.tv_sec < 0)
+ if (timeout.tv_sec < 0) {
+ const char *msg_start = "Error: ctrlchannel_recv_cmd: timed out waiting for chunk";
+ if (recvd >= offsetof(struct input, body)) {
+ logprintf(STDERR_FILENO, "%s for command 0x%08x\n", msg_start, be32toh(input->cmd));
+ SWTPM_PrintAll("Input body", "", input->body, recvd - offsetof(struct input, body));
+ } else {
+ logprintf(STDERR_FILENO, "%s before receiving full command\n", msg_start);
+ }
break;
+ }
to = timeout.tv_sec * 1000 + timeout.tv_nsec / 1E6;
/* wait for the next chunk */
SWTPM_PrintAll(" Ctrl Cmd:", " ", msg.msg_iov->iov_base, min(n, 1024));
if ((size_t)n < sizeof(input.cmd)) {
+ logprintf(STDERR_FILENO, "Error: ctrlchannel_process_fd: input too short\n");
goto err_bad_input;
}
goto err_io;
pss = (ptm_setstate *)input.body;
- if (n < (ssize_t)offsetof(ptm_setstate, u.req.data)) /* rw */
+ if (n < (ssize_t)offsetof(ptm_setstate, u.req.data)) { /* rw */
+ logprintf(STDERR_FILENO, "Error: ctrlchannel_process_fd: input too "
+ "short for CMD_SET_STATEBLOB\n");
+ SWTPM_PrintAll("Input body", "", input.body, n);
goto err_bad_input;
+ }
return ctrlchannel_receive_state(pss, n, fd);