On 07/24/2018 01:36 AM, Markus Armbruster wrote:
Eric Blake <ebl...@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 via email to