aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/intel_iommu.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-08-15 17:53:26 +0800
committerMarkus Armbruster <armbru@redhat.com>2018-08-27 06:38:45 +0200
commitbc6a69dd4bfa41ae56235dcbb9a28a56e12a7dc6 (patch)
treee17291d3690e2bc72249e7a61254b41ead927ea8 /hw/i386/intel_iommu.c
parent235c82acca0491465e94be3cae2583b42d37c859 (diff)
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>
Diffstat (limited to 'hw/i386/intel_iommu.c')
0 files changed, 0 insertions, 0 deletions