qemu-e2k/chardev
Daniel P. Berrangé d1885e549d chardev: disallow TLS/telnet/websocket with tcp_chr_wait_connected
In the previous commit

    commit 1dc8a6695c
    Author: Marc-André Lureau <marcandre.lureau@redhat.com>
    Date:   Tue Aug 16 12:33:32 2016 +0400

      char: fix waiting for TLS and telnet connection

the tcp_chr_wait_connected() method was changed to check for a non-NULL
's->ioc' as a sign that there is already a connection present, as
opposed to checking the "connected" flag to supposedly fix handling of
TLS/telnet connections.

The original code would repeatedly call tcp_chr_wait_connected creating
many connections as 'connected' would never become true. The changed
code would still repeatedly call tcp_chr_wait_connected busy waiting
because s->ioc is set but the chardev will never see CHR_EVENT_OPENED.
IOW, the code is still broken with TLS/telnet, but in a different way.

Checking for a non-NULL 's->ioc' does not mean that a CHR_EVENT_OPENED
will be ready for a TLS/telnet connection. These protocols (and the
websocket protocol) all require the main loop to be running in order
to complete the protocol handshake before emitting CHR_EVENT_OPENED.
The tcp_chr_wait_connected() method is only used during early startup
before a main loop is running, so TLS/telnet/websock connections can
never complete initialization.

Making this work would require changing tcp_chr_wait_connected to run
a main loop. This is quite complex since we must not allow GSource's
that other parts of QEMU have registered to run yet. The current callers
of tcp_chr_wait_connected do not require use of the TLS/telnet/websocket
protocols, so the simplest option is to just forbid this combination
completely for now.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190211182442.8542-14-berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-02-12 17:35:56 +01:00
..
Makefile.objs buildsys: Move brlapi libs to per object 2017-09-22 10:20:34 +08:00
baum.c baum: Truncate braille device size to 84x1 2017-12-21 09:22:44 +01:00
char-console.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
char-fd.c chardev: remove context in chr_update_read_handler 2017-09-22 21:07:27 +02:00
char-fe.c chardev: fix mess in OPENED/CLOSED events when muxed 2019-02-12 17:35:56 +01:00
char-file.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
char-io.c chardev: use a child source for qio input source 2018-10-03 14:45:05 +04:00
char-mux.c chardev: fix mess in OPENED/CLOSED events when muxed 2019-02-12 17:35:56 +01:00
char-null.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
char-parallel.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
char-pipe.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
char-pty.c char: Use error_printf() to print help and such 2018-10-19 14:51:34 +02:00
char-ringbuf.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
char-serial.c serial: Open non-block 2018-07-02 15:41:18 +02:00
char-socket.c chardev: disallow TLS/telnet/websocket with tcp_chr_wait_connected 2019-02-12 17:35:56 +01:00
char-stdio.c chardev: don't splatter terminal settings on exit if not previously set 2018-06-28 19:05:30 +02:00
char-udp.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
char-win-stdio.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
char-win.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
char.c chardev: ensure qemu_chr_parse_compat reports missing driver error 2019-02-12 17:35:56 +01:00
msmouse.c char: move char devices to chardev/ 2017-06-02 11:33:53 +04:00
spice.c configure: bump spice-server required version to 0.12.5 2019-01-10 08:55:13 +01:00
testdev.c char: move char devices to chardev/ 2017-06-02 11:33:53 +04:00
trace-events docs: fix broken paths to docs/devel/tracing.txt 2017-07-31 13:12:53 +03:00
wctablet.c misc: remove headers implicitly included 2017-12-18 17:07:02 +03:00