qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] bc6a69: qemu-error: introduce {error|warn}_re


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] bc6a69: qemu-error: introduce {error|warn}_report_once
Date: Mon, 27 Aug 2018 09:53:53 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: bc6a69dd4bfa41ae56235dcbb9a28a56e12a7dc6
      
https://github.com/qemu/qemu/commit/bc6a69dd4bfa41ae56235dcbb9a28a56e12a7dc6
  Author: Peter Xu <address@hidden>
  Date:   2018-08-27 (Mon, 27 Aug 2018)

  Changed paths:
    M include/qemu/error-report.h

  Log Message:
  -----------
  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 <address@hidden>
CC: Markus Armbruster <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Whitespace adjusted, comments improved]
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 1376211f77bdcd84dc4acb877690f7399d8cf58a
      
https://github.com/qemu/qemu/commit/1376211f77bdcd84dc4acb877690f7399d8cf58a
  Author: Peter Xu <address@hidden>
  Date:   2018-08-27 (Mon, 27 Aug 2018)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/trace-events

  Log Message:
  -----------
  intel-iommu: start to use error_report_once

Replace existing trace_vtd_err() with error_report_once() then stderr
will capture something if any of the error happens, meanwhile we don't
suffer from any DDOS.  Then remove the trace point.  Since at it,
provide more information where proper (now we can pass parameters into
the report function).

Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
[Two format strings fixed, whitespace tidied up]
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 4e4abd111a2af0179a4467368d695958844bf113
      
https://github.com/qemu/qemu/commit/4e4abd111a2af0179a4467368d695958844bf113
  Author: Peter Xu <address@hidden>
  Date:   2018-08-27 (Mon, 27 Aug 2018)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/trace-events

  Log Message:
  -----------
  intel-iommu: replace more vtd_err_* traces

Replace all the trace_vtd_err_*() hooks with the new error_report_once()
since they are similar to trace_vtd_err() - dumping the first error
would be mostly enough, then we have them on by default too.

Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
[Use "%x" instead of "%" PRIx16 to print uint16_t, whitespace tidied up]
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 19b599f7664b2ebfd0f405fb79c14dd241557452
      
https://github.com/qemu/qemu/commit/19b599f7664b2ebfd0f405fb79c14dd241557452
  Author: Peter Maydell <address@hidden>
  Date:   2018-08-27 (Mon, 27 Aug 2018)

  Changed paths:
    M hw/i386/intel_iommu.c
    M hw/i386/trace-events
    M include/qemu/error-report.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2' 
into staging

Error reporting patches for 2018-08-27

# gpg: Signature made Mon 27 Aug 2018 14:18:15 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg:                 aka "Markus Armbruster <address@hidden>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2018-08-27-v2:
  intel-iommu: replace more vtd_err_* traces
  intel-iommu: start to use error_report_once
  qemu-error: introduce {error|warn}_report_once

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/e1e388900d84...19b599f7664b
      **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]