Red Hat Bugzilla – Bug 1460338
guestfs_shutdown hangs if main process sets signal handlers
Last modified: 2017-06-13 11:45:16 EDT
Created attachment 1286485 [details]
Description of problem:
(Reported by wtfuzz on IRC)
The attached program fails, but only when an LVM volume
group is open in the main process (using lvm2app).
It seems as if lvm2app fiddles with signal handlers, and
those are inherited by the forked qemu process, preventing
it from seeing the SIGTERM signal that we later send. So
See attached example code and debug.
Version-Release number of selected component (if applicable):
libguestfs 1.32.7 (from Debian)
100% when lvm_vg_open has been called in the main process.
Created attachment 1286486 [details]
From the reporter:
21:25 < wtfuzz> rwmjones: I can confirm that setting up SIGTERM in a sigset_t, and doing a sigprocmask(SIG_UNBLOCK, &mask, NULL) after lvm_vg_open() fixes my issue
I was able to reproduce this easily with upstream by adjusting
one of the example programs to include this code in main():
guestfs_set_backend (g, "direct");
sigaddset (&set, SIGTERM);
sigprocmask (SIG_BLOCK, &set, NULL);
Note this only affects the 'direct' backend.
Patch posted upstream:
Fixed upstream in:
In libguestfs >= 1.37.15.