qemu-e2k/include
Daniel P. Berrangé a2458b6f69 io: return 0 for EOF in TLS session read after shutdown
GNUTLS takes a paranoid approach when seeing 0 bytes returned by the
underlying OS read() function. It will consider this an error and
return GNUTLS_E_PREMATURE_TERMINATION instead of propagating the 0
return value. It expects apps to arrange for clean termination at
the protocol level and not rely on seeing EOF from a read call to
detect shutdown. This is to harden apps against a malicious 3rd party
causing termination of the sockets layer.

This is unhelpful for the QEMU NBD code which does have a clean
protocol level shutdown, but still relies on seeing 0 from the I/O
channel read in the coroutine handling incoming replies.

The upshot is that when using a plain NBD connection shutdown is
silent, but when using TLS, the client spams the console with

  Cannot read from TLS channel: Broken pipe

The NBD connection has, however, called qio_channel_shutdown()
at this point to indicate that it is done with I/O. This gives
the opportunity to optimize the code such that when the channel
has been shutdown in the read direction, the error code
GNUTLS_E_PREMATURE_TERMINATION gets turned into a '0' return
instead of an error.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20181119134228.11031-1-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-11-19 11:16:46 -06:00
..
block block: Require auto-read-only for existing fallbacks 2018-11-05 15:09:55 +01:00
chardev chardev: mark the calls that allow an implicit mux monitor 2018-10-03 14:45:05 +04:00
crypto tests: call qcrypto_init instead of gnutls_global_init 2018-07-24 17:33:39 +01:00
disas target/mips: Add disassembler support for nanoMIPS 2018-10-25 22:13:33 +02:00
exec memory: learn about non-volatile memory region 2018-11-06 21:35:05 +01:00
fpu softfloat: Don't execute divdeu without power7 2018-11-04 10:04:40 +00:00
hw ppc patch queue 2018-11-08 2018-11-08 14:42:37 +00:00
io io: return 0 for EOF in TLS session read after shutdown 2018-11-19 11:16:46 -06:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration COLO: Remove colo_state migration struct 2018-10-19 11:15:03 +08:00
monitor qdev-monitor: print help to stdout 2018-10-05 16:14:22 +04:00
net filter: Add handle_event method for NetFilterClass 2018-10-19 11:15:03 +08:00
qapi error: Fix use of error_prepend() with &error_fatal, &error_abort 2018-10-19 14:51:34 +02:00
qemu include/qemu/thread.h: Document qemu_thread_atexit* API 2018-11-06 21:35:06 +01:00
qom cputlb: Move cpu->pending_tlb_flush to env->tlb_c.pending_flush 2018-10-31 12:16:02 +00:00
scsi pr-manager: add query-pr-managers QMP command 2018-06-28 19:05:35 +02:00
standard-headers linux-headers: update 2018-10-12 11:32:18 +02:00
sysemu block: change some function return type to bool 2018-11-05 15:09:54 +01:00
ui ui: Convert vnc_display_init(), init_keyboard_layout() to Error 2018-10-19 14:51:34 +02:00
elf.h elf: Define MIPS_ABI_FP_UNKNOWN macro 2018-10-29 15:47:32 +01:00
glib-compat.h glib: enforce the minimum required version and warn about old APIs 2018-06-29 12:22:28 +01:00
qemu-common.h qemu-common.h: update copyright date to 2018 2018-10-16 17:52:06 +02:00
qemu-io.h qemu-io: Let command functions return error code 2018-06-11 16:18:45 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00