Skip to content

Commit 017704b

Browse files
committed
Do not make a file description blocking while it is still in use
use_stdio_socket means that stdin and stdout FDs use the same file description, which is certainly the case for socket-based services. Before this change, it was set to false in this case. This would cause the file description to be made blocking while it is still in use, potentially causing deadlocks. git blame points to commit 0802df7 ("Factor out process_child_io"), but I suspect the actual bug dates back as far as the introduction of socket-based services in 76697e3 ("Working socket-based qrexec"). Fixes: QubesOS/qubes-issues#9169
1 parent 652b8f5 commit 017704b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libqrexec/process_io.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int process_io(const struct process_io_request *req) {
116116
pid_t local_status = -1;
117117
pid_t remote_status = -1;
118118
int stdout_msg_type = is_service ? MSG_DATA_STDOUT : MSG_DATA_STDIN;
119-
bool use_stdio_socket = false;
119+
bool use_stdio_socket = stdin_fd == stdout_fd;
120120

121121
int ret;
122122
struct pollfd fds[FD_NUM];

0 commit comments

Comments
 (0)