All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/qtest/libqtest: Do not overwrite child coredump
@ 2020-07-07  3:19 Philippe Mathieu-Daudé
  2020-07-07  9:03 ` Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-07  3:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Richard Henderson,
	Markus Armbruster, Philippe Mathieu-Daudé,
	Yury Kotov, Paolo Bonzini

We are interested by the coredump of the child, not the qtest
parent. If the child generated a coredump, simply call
exit(EXIT_FAILURE) in the parent to avoid overwriting the
child coredump.

Fixes: 71a268a5fd ("tests/libqtest: Improve kill_qemu()")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/qtest/libqtest.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 49075b55a1..bd85d01145 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -173,7 +173,12 @@ static void kill_qemu(QTestState *s)
         fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
                 "from signal %d (%s)%s\n",
                 __FILE__, __LINE__, sig, signame, dump);
-        abort();
+        if (WCOREDUMP(wstatus)) {
+            /* Preserve child coredump */
+            exit(1);
+        } else {
+            abort();
+        }
     }
 }
 
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/qtest/libqtest: Do not overwrite child coredump
  2020-07-07  3:19 [PATCH] tests/qtest/libqtest: Do not overwrite child coredump Philippe Mathieu-Daudé
@ 2020-07-07  9:03 ` Thomas Huth
  2020-07-07  9:29   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2020-07-07  9:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Richard Henderson, Markus Armbruster, Yury Kotov,
	Paolo Bonzini

On 07/07/2020 05.19, Philippe Mathieu-Daudé wrote:
> We are interested by the coredump of the child, not the qtest
> parent. If the child generated a coredump, simply call
> exit(EXIT_FAILURE) in the parent to avoid overwriting the
> child coredump.
> 
> Fixes: 71a268a5fd ("tests/libqtest: Improve kill_qemu()")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/qtest/libqtest.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index 49075b55a1..bd85d01145 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -173,7 +173,12 @@ static void kill_qemu(QTestState *s)
>          fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
>                  "from signal %d (%s)%s\n",
>                  __FILE__, __LINE__, sig, signame, dump);
> -        abort();
> +        if (WCOREDUMP(wstatus)) {
> +            /* Preserve child coredump */
> +            exit(1);
> +        } else {
> +            abort();
> +        }
>      }
>  }

Would it maybe rather make sense to always use exit(1) unconditionally here?

 Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/qtest/libqtest: Do not overwrite child coredump
  2020-07-07  9:03 ` Thomas Huth
@ 2020-07-07  9:29   ` Paolo Bonzini
  2020-07-07 13:32     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2020-07-07  9:29 UTC (permalink / raw)
  To: Thomas Huth, Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Yury Kotov, Richard Henderson, Markus Armbruster

On 07/07/20 11:03, Thomas Huth wrote:
>> +++ b/tests/qtest/libqtest.c
>> @@ -173,7 +173,12 @@ static void kill_qemu(QTestState *s)
>>          fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
>>                  "from signal %d (%s)%s\n",
>>                  __FILE__, __LINE__, sig, signame, dump);
>> -        abort();
>> +        if (WCOREDUMP(wstatus)) {
>> +            /* Preserve child coredump */
>> +            exit(1);
>> +        } else {
>> +            abort();
>> +        }
>>      }
>>  }
> Would it maybe rather make sense to always use exit(1) unconditionally here?

But why is it a problem to overwrite the child core dump?  Aren't both
stashed away if you use the core.PID name as is common?

Paolo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/qtest/libqtest: Do not overwrite child coredump
  2020-07-07  9:29   ` Paolo Bonzini
@ 2020-07-07 13:32     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-07 13:32 UTC (permalink / raw)
  To: Paolo Bonzini, Thomas Huth, qemu-devel
  Cc: Laurent Vivier, Yury Kotov, Richard Henderson, Markus Armbruster

On 7/7/20 11:29 AM, Paolo Bonzini wrote:
> On 07/07/20 11:03, Thomas Huth wrote:
>>> +++ b/tests/qtest/libqtest.c
>>> @@ -173,7 +173,12 @@ static void kill_qemu(QTestState *s)
>>>          fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
>>>                  "from signal %d (%s)%s\n",
>>>                  __FILE__, __LINE__, sig, signame, dump);
>>> -        abort();
>>> +        if (WCOREDUMP(wstatus)) {
>>> +            /* Preserve child coredump */
>>> +            exit(1);
>>> +        } else {
>>> +            abort();
>>> +        }
>>>      }
>>>  }
>> Would it maybe rather make sense to always use exit(1) unconditionally here?
> 
> But why is it a problem to overwrite the child core dump?  Aren't both
> stashed away if you use the core.PID name as is common?

I'm not sure what you mean. Without this patch, the coredump I get
is qtest parent, coredumpctl list the child but the coredump is
unavailable. With this patch I don't get the uninteresting (for my
uses) qtest parent but the child coredump. I'm using Fedora 30,
I don't remember changing the coredumpctl default config. Travis-CI
is based on Ubuntu.

> 
> Paolo
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-07 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  3:19 [PATCH] tests/qtest/libqtest: Do not overwrite child coredump Philippe Mathieu-Daudé
2020-07-07  9:03 ` Thomas Huth
2020-07-07  9:29   ` Paolo Bonzini
2020-07-07 13:32     ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.