qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, rth@twiddle.net,
	alex.bennee@linaro.org, f4bug@amsat.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 for-3.0] tests/libqtest: Improve kill_qemu()
Date: Tue, 24 Jul 2018 09:35:58 -0500	[thread overview]
Message-ID: <8c082bfd-6753-c8d2-cfcd-e2be77c3f763@redhat.com> (raw)
In-Reply-To: <87in553zsx.fsf@dusky.pond.sub.org>

On 07/24/2018 01:36 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> In kill_qemu() we have an assert that checks that the QEMU process
>> didn't dump core:
>>              assert(!WCOREDUMP(wstatus));
>>
>> Unfortunately the WCOREDUMP macro here means the resulting message
>> is not very easy to comprehend on at least some systems:
>>

>> -        if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) {
>> -            assert(!WCOREDUMP(wstatus));

>> +            } else if (WIFSIGNALED(wstatus)) {
>> +                int sig = WTERMSIG(wstatus);
>> +                const char *signame = strsignal(sig) ?: "unknown ???";
>> +
>> +                if (!WCOREDUMP(wstatus)) {
>> +                    die = false;
> 
> Does WCOREDUMP(wstatus) depend on the user's ulimit -c?

'man waitpid' on Linux mentions that WCOREDUMP is nonportable, but does 
not mention any interaction with setrlimit.  But a quick test shows:

$ ulimit -S -c 0
$ cat foo.c
int main(int argc, char **argv) {
   return *argv[1];
}
$ gcc -o foo -Wall foo.c
$ ./foo 1
$ ./foo
Segmentation fault (core dumped)
$

the output was produced by bash, which uses waitpid() - and therefore 
the fact that bash reports the core dump even when no core file is 
created is promising.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-07-24 14:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 19:35 [Qemu-devel] [PATCH v2 for-3.0] tests/libqtest: Improve kill_qemu() Eric Blake
2018-07-23 20:20 ` Richard Henderson
2018-07-24  6:36 ` Markus Armbruster
2018-07-24 14:35   ` Eric Blake [this message]
2018-07-25 16:17     ` Markus Armbruster
2018-07-30 21:24       ` Eric Blake
2018-07-31  5:35         ` Markus Armbruster
2018-07-24  6:44 ` Thomas Huth
2018-07-30 21:26   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c082bfd-6753-c8d2-cfcd-e2be77c3f763@redhat.com \
    --to=eblake@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).