The error paths in reg_ioat() that are triggered by a guest providing
invalid MPCIFC arguments use error_report(), which writes unconditionally
to stderr. A misbehaving guest can exploit this to flood the host log
by repeatedly issuing the instruction with bad arguments.
Replace these with qemu_log_mask(LOG_GUEST_ERROR, ...) so that the
messages are suppressible.
Fixes: 863f6f52b713 ("s390: implement pci instructions")
Fixes: dfcee1ea4c52 ("s390x/pci: add support for guests that request direct
mapping")
Cc: [email protected]
Signed-off-by: Matthew Rosato <[email protected]>
---
hw/s390x/s390-pci-inst.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index a51543df44..c6da3b4c07 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -17,6 +17,7 @@
#include "system/memory.h"
#include "qemu/error-report.h"
#include "qemu/bswap.h"
+#include "qemu/log.h"
#include "system/hw_accel.h"
#include "hw/core/boards.h"
#include "hw/pci/pci_device.h"
@@ -1044,11 +1045,12 @@ static int reg_ioat(CPUS390XState *env,
S390PCIBusDevice *pbdev, ZpciFib fib,
/* currently we only support designation type 1 with translation */
if (t && dt != ZPCI_IOTA_RTTO) {
- error_report("unsupported ioat dt %d t %d", dt, t);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "unsupported ioat dt %d t %d", dt, t);
s390_program_interrupt(env, PGM_OPERAND, ra);
return -EINVAL;
} else if (!t && !pbdev->rtr_avail) {
- error_report("relaxed translation not allowed");
+ qemu_log_mask(LOG_GUEST_ERROR, "relaxed translation not allowed");
s390_program_interrupt(env, PGM_OPERAND, ra);
return -EINVAL;
}
--
2.55.0