qemu-patch-raspberry4/include
Peter Xu bc6a69dd4b qemu-error: introduce {error|warn}_report_once
There are many error_report()s that can be used in frequently called
functions, especially on IO paths.  That can be unideal in that
malicious guest can try to trigger the error tons of time which might
use up the log space on the host (e.g., libvirt can capture the stderr
of QEMU and put it persistently onto disk).  In VT-d emulation code, we
have trace_vtd_error() tracer.  AFAIU all those places can be replaced
by something like error_report() but trace points are mostly used to
avoid the DDOS attack that mentioned above.  However using trace points
mean that errors are not dumped if trace not enabled.

It's not a big deal in most modern server managements since we have
things like logrotate to maintain the logs and make sure the quota is
expected.  However it'll still be nice that we just provide another way
to restrict message generations.  In most cases, this kind of
error_report()s will only provide valid information on the first message
sent, and all the rest of similar messages will be mostly talking about
the same thing.  This patch introduces *_report_once() helpers to allow
a message to be dumped only once during one QEMU process's life cycle.
It will make sure: (1) it's on by deffault, so we can even get something
without turning the trace on and reproducing, and (2) it won't be
affected by DDOS attack.

To implement it, I stole the printk_once() macro from Linux.

CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180815095328.32414-2-peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Whitespace adjusted, comments improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-08-27 06:38:45 +02:00
..
block block: Fix documentation for BDRV_REQ_MAY_UNMAP 2018-07-30 15:35:37 +02:00
chardev chardev/char-fe: Fix typos 2018-08-23 13:32:50 +02:00
crypto tests: call qcrypto_init instead of gnutls_global_init 2018-07-24 17:33:39 +01:00
disas RISC-V Disassembler 2018-03-07 08:30:28 +13:00
exec linux-user fixes: 2018-08-21 11:36:15 +01:00
fpu softfloat: Add scaling float-to-int routines 2018-08-24 13:17:30 +01:00
hw elf: On elf loading, treat both EM_MIPS and EM_NANOMIPS as legal for MIPS 2018-08-24 17:51:59 +02:00
io qio: non-default context for TLS handshake 2018-03-06 10:19:07 +00:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration vmstate.h: Provide VMSTATE_UINT16_SUB_ARRAY 2018-08-14 17:17:20 +01:00
monitor monitor: Fix unsafe sharing of @cur_mon among threads 2018-07-23 14:00:03 +02:00
net net: Remove the deprecated "vlan" parameter 2018-05-14 15:47:14 +08:00
qapi json: Update references to RFC 7159 to RFC 8259 2018-08-24 20:27:14 +02:00
qemu qemu-error: introduce {error|warn}_report_once 2018-08-27 06:38:45 +02:00
qom qom: convert the CPU list to RCU 2018-08-23 18:46:25 +02:00
scsi pr-manager: add query-pr-managers QMP command 2018-06-28 19:05:35 +02:00
standard-headers fw_cfg: import & use linux/qemu_fw_cfg.h 2018-08-23 18:46:25 +02:00
sysemu fw_cfg: ignore suffixes in the bootdevice list dependent on machine class 2018-08-16 22:27:43 -03:00
ui Add gles support to egl-helpers, wire up in egl-headless and gtk. 2018-06-26 13:48:49 +02:00
elf.h elf: Add EM_NANOMIPS value as a valid one for e_machine field 2018-08-24 17:51:59 +02: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-options: Bail out on unsupported options instead of silently ignoring them 2018-05-09 00:13:39 +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