On 13/06/2024 13.59, Дмитрий Фролов wrote:


On 13.06.2024 13:08, Thomas Huth wrote:
On 23/05/2024 12.28, Dmitry Frolov wrote:
If QTestState was already CLOSED due to error, calling qtest_clock_step()
afterwards makes no sense and only raises false-crash with message:
"assertion timer != NULL failed".

Signed-off-by: Dmitry Frolov <fro...@swemel.ru>
---
  tests/qtest/fuzz/virtio_net_fuzz.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/tests/qtest/fuzz/virtio_net_fuzz.c b/tests/qtest/fuzz/virtio_net_fuzz.c
index e239875e3b..2f57a8ddd8 100644
--- a/tests/qtest/fuzz/virtio_net_fuzz.c
+++ b/tests/qtest/fuzz/virtio_net_fuzz.c
@@ -81,6 +81,9 @@ static void virtio_net_fuzz_multi(QTestState *s,
          /* Run the main loop */
          qtest_clock_step(s, 100);
          flush_events(s);
+        if (!qtest_probe_child(s)) {
+            return;
+        }

According to your patch description, it rather sounds like the check should be done before the qtest_clock_step() ? ... or where does the QTestState get closed? During flush_events() ?
To my understanding, the main loop is executed during flush_events(), where an error may occur. This behavior is legit and should not produce any crash report. Without the check, the test continues to wait on used descriptors, and finally fails with message: "assertion timer != NULL failed".
Thus, any invalid input data produces a meaningless crash report.

Ok, makes sense now, thanks!

There seems to be another while loop with a flush_events() call later in this file, does it maybe need the same treatment, too?

 Thomas


Reply via email to