Bug 1026314
| Summary: | BUG: qemu-kvm hang when use '-sandbox on'+'vnc'+'hda' | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | CongLi <coli> | ||||||||||||||||||||||||||||
| Component: | qemu-kvm | Assignee: | Paul Moore <pmoore> | ||||||||||||||||||||||||||||
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | ||||||||||||||||||||||||||||
| Severity: | high | Docs Contact: | |||||||||||||||||||||||||||||
| Priority: | medium | ||||||||||||||||||||||||||||||
| Version: | 7.0 | CC: | coli, eotubo, eparis, flang, huding, juzhang, knoel, mazhang, michen, mrezanin, pmoore, pm-rhel, rbalakri, shuang, virt-maint, xfu, xuhan, xwei | ||||||||||||||||||||||||||||
| Target Milestone: | rc | ||||||||||||||||||||||||||||||
| Target Release: | --- | ||||||||||||||||||||||||||||||
| Hardware: | Unspecified | ||||||||||||||||||||||||||||||
| OS: | Unspecified | ||||||||||||||||||||||||||||||
| Whiteboard: | |||||||||||||||||||||||||||||||
| Fixed In Version: | qemu-kvm-1.5.3-77.el7 | Doc Type: | Bug Fix | ||||||||||||||||||||||||||||
| Doc Text: | Story Points: | --- | |||||||||||||||||||||||||||||
| Clone Of: | Environment: | ||||||||||||||||||||||||||||||
| Last Closed: | 2015-03-05 08:01:54 UTC | Type: | Bug | ||||||||||||||||||||||||||||
| Regression: | --- | Mount Type: | --- | ||||||||||||||||||||||||||||
| Documentation: | --- | CRM: | |||||||||||||||||||||||||||||
| Verified Versions: | Category: | --- | |||||||||||||||||||||||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||||||||||||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||||||||||||||||||
| Embargoed: | |||||||||||||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||||||||||||
Created attachment 819123 [details]
strace-non-sandbox.txt
Looking at the strace output, an educated guess is that the kill(...) syscall is missing from the seccomp syscall filter. Assuming a normal RHEL7 install/configuration you should be able to verify this by checking the audit log, please run the following command: # ausearch -m SECCOMP If you see any results and you have libseccomp-devel installed you can resolve the syscall number (the value indicated by "syscall=XXX" in the ausearch output) using the command below: # scmp_sys_resolver XXX (In reply to Paul Moore from comment #3) Tested on version: kernel-3.10.0-48.el7.x86_64 qemu-kvm-1.5.3-19.el7.x86_64 libseccomp-2.1.1-0.el7.x86_64 libseccomp-devel-2.1.1-0.el7.x86_64 1. # ausearch -m SECCOMP ---- time->Wed Nov 20 09:52:08 2013 type=SECCOMP msg=audit(1384912328.482:6656): auid=0 uid=0 gid=0 ses=854 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12087 comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f7a1d2abc67 code=0x0 2. # scmp_sys_resolver 62 kill Thank you for the verification, I'm building a patched qemu-kvm package right now for you to test. Created attachment 826740 [details]
QEMU seccomp patch
Potential fix
The patch has been posted upstream: * http://marc.info/?l=qemu-devel&m=138504847432633&w=2 The patch has been merged into the QEMU/seccomp tree and a pull request has been sent: * http://marc.info/?l=qemu-devel&m=138607511631440&w=2 Reproduce this bug with component: qemu-kvm-1.5.3-21.el7.x86_64 libseccomp-2.1.1-0.el7.x86_64 kernel-3.10.0-64.el7.x86_64 Steps: 1. boot guest with '-sandbox on'+'vnc'+'hda'. # /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 Results: qemu-kvm hang. # ps aux | grep qemu root 12574 0.2 0.0 0 0 pts/3 Zl+ 18:03 0:00 [qemu-kvm] <defunct> root 12580 0.0 0.0 112632 972 pts/4 S+ 18:03 0:00 grep --color=auto qemu ------------------------------- Verify this bug with component: qemu-kvm-1.5.3-30.el7.x86_64 libseccomp-2.1.1-0.el7.x86_64 kernel-3.10.0-64.el7.x86_64 Same steps as above. Results: qemu-kvm hang as well. # ps aux | grep qemu root 12736 0.4 0.0 0 0 pts/3 Zl+ 18:08 0:00 [qemu-kvm] <defunct> root 12742 0.0 0.0 112632 972 pts/4 S+ 18:08 0:00 grep --color=auto qemu -------------------------------------------- Check this issue following comment 3, found: # ausearch -m SECCOMP ---- time->Wed Dec 25 18:03:38 2013 type=SECCOMP msg=audit(1387965818.737:694): auid=0 uid=0 gid=0 ses=7 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12574 comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f6d2160ac67 code=0x0 ---- time->Wed Dec 25 18:08:05 2013 type=SECCOMP msg=audit(1387966085.758:703): auid=0 uid=0 gid=0 ses=7 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12736 comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7f4282694847 code=0x0 # scmp_sys_resolver 62 kill # scmp_sys_resolver 83 mkdir As these test results above, I'd set the status as ASSIGNED. Created attachment 841711 [details]
strace log
Attach the strace log.
(In reply to xuhan from comment #14) > -------------------------------------------- > Check this issue following comment 3, found: > # ausearch -m SECCOMP > ---- > time->Wed Dec 25 18:03:38 2013 > type=SECCOMP msg=audit(1387965818.737:694): auid=0 uid=0 gid=0 ses=7 > subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12574 > comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f6d2160ac67 code=0x0 > ---- > time->Wed Dec 25 18:08:05 2013 > type=SECCOMP msg=audit(1387966085.758:703): auid=0 uid=0 gid=0 ses=7 > subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12736 > comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7f4282694847 code=0x0 > > # scmp_sys_resolver 62 > kill > # scmp_sys_resolver 83 > mkdir In the first SECCOMP audit record, the qemu-kvm process ID is 12574 which is the unpatched version; the failure on the kill() syscall is expected. However, in the second SECCOMP audit record, the process ID is 12736 which is the patched version of the qemu-kvm package; the mkdir() failure is unexpected. Is there something different from your test environment than what was used by CongLi when the temporary Brew build was tested? (In reply to Paul Moore from comment #16) > Is there something different from your test environment than what was used > by CongLi when the temporary Brew build was tested? Checking this issue with CongLi, will update soon. Boot guest with following cmdline will see such errors below. # /usr/libexec/qemu-kvm -device intel-hda -device hda-duplex -vnc :0 pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize DAC alsa: Failed to open `default': alsa: Reason: No such file or directory ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize DAC alsa: Failed to open `default': alsa: Reason: No such file or directory audio: Failed to create voice `dac' ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize ADC alsa: Failed to open `default': alsa: Reason: No such file or directory ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize ADC alsa: Failed to open `default': alsa: Reason: No such file or directory audio: Failed to create voice `adc' If add '-sandbox on' in cmdline, then would hit the issue in comment 14. if use spice instead vnc, it's failed to these errors above, and using '-sandbox on' would not lead qemu-kvm hang. But it's weird that I could reproduced this bug via kvm_session or ssh remoting boot the guest with my laptop, but CongLi couldn't by using hers. So, CongLi would like to provide her env, thanks. (In reply to Paul Moore from comment #16) > Is there something different from your test environment than what was used > by CongLi when the temporary Brew build was tested? Hi Paul, Tested this bug on the following version: kernel-3.10.0-65.el7.x86_64 qemu-kvm-1.5.3-31.el7.x86_64 1. via ssh to access the machine (pass) # /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver # ps aux | grep qemu root 9599 5.2 0.0 528368 24252 pts/1 Sl+ 16:32 0:03 /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 root 9605 0.0 0.0 112640 964 pts/2 S+ 16:33 0:00 grep --color=auto qemu 2. via kvm [remote control] to access the machine(fail) qemu-kvm hang as #comment 1 # /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 (qemu) # ausearch -m SECCOMP ---- time->Fri Jan 3 13:58:04 2014 type=SECCOMP msg=audit(1388728684.008:46404): auid=0 uid=0 gid=0 ses=6297 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=18212 comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f55a39fbc67 code=0x0 ---- time->Fri Jan 3 14:40:23 2014 type=SECCOMP msg=audit(1388731223.837:46521): auid=0 uid=0 gid=0 ses=6302 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=18641 comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7fc84b0a9747 code=0x0 ---- # scmp_sys_resolver 62 kill # scmp_sys_resolver 83 mkdir 3. I have also tested on other machine. (both local & ssh are failed) # /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver # ps aux | grep qemu root 1833 0.1 0.0 0 0 pts/0 Zl+ 16:37 0:00 [qemu-kvm] <defunct> root 1878 0.0 0.0 112644 932 pts/1 S+ 16:38 0:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Fri Jan 3 13:22:59 2014 type=SECCOMP msg=audit(1388726579.897:134): auid=0 uid=0 gid=0 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=8869 comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7fdb41dd2747 code=0x0 ---- time->Fri Jan 3 16:37:55 2014 type=SECCOMP msg=audit(1388738275.186:368): auid=0 uid=0 gid=0 ses=21 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=1833 comm="qemu-kvm" sig=31 syscall=29 compat=0 ip=0x7f04f3a0da87 code=0x0 # scmp_sys_resolver 83 mkdir # scmp_sys_resolver 29 shmget From the above, I think it may be env related, and I will attach my env.txt. And if you need any info to collect, please tell me. Thanks, Cong Created attachment 844876 [details]
env.txt
On my test system, the issue appears to be directly related to the "-device intel-hda -device hda-duplex" options and PulseAudio. Looking at the strace output it appears that PulseAudio (libpulse.so.0 I suspect) is trying to create a directory under "/run" (example from as run as root, UID=0):
mkdir("/run/user/0/pulse", 0700) = -1 EEXIST (File exists)
Unfortunately, it appears as though we need to add mkdir(2) to the syscall whitelist to appease PulseAudio.
It appears that fchmod(2) is also needed. Hi Xu, Could you have a try comment25 and update the result in the bz? Best Regards, Junyi That's odd, I don't see shmget(2) in my strace output, do you have a sound card in your test system? I don't, that might be the difference. I'll add shmget(2) to the whitelist and do another build for you to test. Thanks for your patience. I'm also going to include shmat(2) and shmdt(2) in this new test build as it is likely they would also be needed. Could you generate a new strace log file for me (hopefully it will include the shmem syscalls, the current ones do not)? You should create the new strace log without the sandbox enabled, for example: # qemu-kvm -monitor stdio -device intel-hda -device hda-duplex -vnc :0 I'm looking at both attachment #846379 [details] and #846380 and neither of the strace logs has shmget() in the strace ... did you do something different during the most recent tests?
Before I can submit the patches upstream, I'd like to understand what is triggering the shared memory calls, and based on the recent logs you posted it appears that QEMU is not using shmget().
Upstream postings: * http://marc.info/?l=qemu-devel&m=138981476927714&w=2 * http://marc.info/?l=qemu-devel&m=138981475427710&w=2 * http://marc.info/?l=qemu-devel&m=138981476027713&w=2 Patches have been merged into the upstream QEMU/seccomp maintainer's tree: * http://marc.info/?l=qemu-devel&m=139023104626531&w=2 The patches have been merged into the main QEMU tree:
commit 918b94e2873cd5fe8aef06d269b4a4c7d0832ce7
Author: Paul Moore <pmoore>
Date: Wed Jan 15 14:38:58 2014 -0500
seccomp: add some basic shared memory syscalls to the whitelist
PulseAudio requires the use of shared memory so add shmget(), shmat(),
and shmdt() to the syscall whitelist.
Reported-by: xuhan
Signed-off-by: Paul Moore <pmoore>
commit 0c2acb163fbb4579dad2d45595570b0a9ff71149
Author: Paul Moore <pmoore>
Date: Wed Jan 15 14:38:51 2014 -0500
seccomp: add mkdir() and fchmod() to the whitelist
The PulseAudio library attempts to do a mkdir(2) and fchmod(2) on
"/run/user/<UID>/pulse" which is currently blocked by the syscall
filter; this patch adds the two missing syscalls to the whitelist.
You can reproduce this problem with the following command:
# qemu -monitor stdio -device intel-hda -device hda-duplex
If watched under strace the following syscalls are shown:
mkdir("/run/user/0/pulse", 0700)
fchmod(11, 0700) [NOTE: 11 is the fd for /run/user/0/pulse]
Reported-by: xuhan
Signed-off-by: Paul Moore <pmoore>
Fix included in qemu-kvm-1.5.3-47.el7 Reproduce this bug as follow version: Host: # uname -r 3.10.0-86.el7.x86_64 # rpm -q qemu-kvm qemu-kvm-1.5.3-46.el7.x86_64 Stesp: 1.Boot guest /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 2.Check qemu Results: qemu hang # ps -ef |grep qemu root 1895 1699 0 13:28 pts/0 00:00:00 [qemu-kvm] <defunct> root 1943 1904 0 13:31 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Tue Feb 18 13:28:12 2014 type=SECCOMP msg=audit(1392701292.621:206): auid=0 uid=0 gid=0 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=1895 comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7f9d3176d977 code=0x0 Latest version: Host: # uname -r 3.10.0-86.el7.x86_64 # rpm -q qemu-kvm qemu-kvm-1.5.3-48.el7.x86_64 Steps: 1.# /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver Results: qemu hang # ps -ef |grep qemu root 2086 2054 0 13:44 pts/0 00:00:00 [qemu-kvm] <defunct> root 2092 1904 0 13:44 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Tue Feb 18 13:28:12 2014 type=SECCOMP msg=audit(1392701292.621:206): auid=0 uid=0 gid=0 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=1895 comm="qemu-kvm" sig=31 syscall=83 compat=0 ip=0x7f9d3176d977 code=0x0 ---- time->Tue Feb 18 13:41:56 2014 type=SECCOMP msg=audit(1392702116.733:238): auid=0 uid=0 gid=0 ses=18 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=2027 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7ff2e04bbe67 code=0x0 ---- time->Tue Feb 18 13:44:02 2014 type=SECCOMP msg=audit(1392702242.974:263): auid=0 uid=0 gid=0 ses=21 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=2086 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7ff67077ae67 code=0x0 # scmp_sys_resolver 149 mlock According to above test ,this bug not fixed. Hi Paul please help see . thanks fang lang I just checked it on my system and everything worked as expected. Is this the same test system that was used previously? # rpm -q qemu-kvm libseccomp qemu-kvm-1.5.3-48.el7.x86_64 libseccomp-2.1.1-1.el7.x86_64 Test this bug on latest version Host: # uname -r 3.10.0-86.el7.x86_64 # rpm -q qemu-kvm qemu-kvm-1.5.3-48.el7.x86_64 # rpm -q seabios seabios-1.7.2.2-11.el7.x86_64 Senario 1)with "-sandbox on" Steps: 1.# /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver Results: qemu hang # ps -ef |grep qemu root 2086 2054 0 13:44 pts/0 00:00:00 [qemu-kvm] <defunct> root 2092 1904 0 13:44 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Fri Feb 21 12:27:17 2014 type=SECCOMP msg=audit(1392956837.869:4462): auid=0 uid=0 gid=0 ses=536 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=13693 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7f0679274e67 code=0x0 # scmp_sys_resolver 149 mlock Senario 2)with "-sandbox off" Steps as same as senario 1),except boot guest with "-sandbox off" Results: # /usr/libexec/qemu-kvm -monitor stdio -sandbox off -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver (qemu) info status VM status: running (qemu) # ps -ef |grep qemu root 13747 13524 3 12:30 pts/0 00:00:03 /usr/libexec/qemu-kvm -monitor stdio -sandbox off -device intel-hda -device hda-duplex -vnc :0 root 13757 13703 0 12:32 pts/1 00:00:00 grep --color=auto qemu #ausearch -m SECCOMP ---- time->Fri Feb 21 12:27:17 2014 type=SECCOMP msg=audit(1392956837.869:4462): auid=0 uid=0 gid=0 ses=536 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=13693 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7f0679274e67 code=0x0 [root@localhost ~]# scmp_sys_resolver 149 mlock Created attachment 865825 [details]
strace-sandbox-off
Created attachment 865827 [details]
strace-sandbox-on
Thank you for the strace logs; it appears to still be PulseAudio related. I'm going to move this back to ASSIGNED until we have a fix. I'm still not sure why this didn't surface earlier, there must be something machine/driver specific. Created attachment 866047 [details] 01-bz1026314-3.patch Could you test the fix above and let me know if it solves the problem you are seeing? Created attachment 867241 [details]
strace_sandbox_on
Created attachment 867242 [details]
strace_sandbox_off
Created attachment 867844 [details]
sandbox_on
Created attachment 867845 [details]
sandbox off
Patch posted upstream, I'll submit it internally as soon as it is merged. * http://marc.info/?l=qemu-devel&m=139342834013276&w=2 The patch has been merged into the QEMU/seccomp tree, as soon as it hits the main QEMU tree I'll post it internally. * http://marc.info/?l=qemu-devel&m=139471820103798&w=2 This has still not landed in the QEMU upstream tree. As we do not see a large number of customers who will need to share their sound card into the VM and, as a work around, they an use spice, this bug is being moved to 7.1. Fix included in qemu-kvm-1.5.3-66.el7 Reproduce this bug using the following version: qemu-kvm-1.5.3-63.el7.x86_64 kernel-3.10.0-140.el7.x86_64 Stesp: 1.Boot guest /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 2.Check qemu Results: qemu hang # ps -ef |grep qemu root 914 6288 0 13:25 pts/0 00:00:00 [qemu-kvm] <defunct> root 28287 23407 0 13:32 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Tue Aug 5 13:25:52 2014 type=SECCOMP msg=audit(1407216352.200:1587): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=914 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7f7b6d111ea7 code=0x0 Test this bug on an intel host using the following version: qemu-kvm-1.5.3-66.el7.x86_64 kernel-3.10.0-140.el7.x86_64 Steps to Test: 1.Boot guest /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 1.5.3 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver (qemu) info status VM status: running Results: qemu-kvm works well and not hang # ps -ef |grep qemu root 23317 6288 2 13:35 pts/0 00:00:03 /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 root 24174 23407 0 13:37 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Tue Aug 5 13:25:52 2014 type=SECCOMP msg=audit(1407216352.200:1587): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=914 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7f7b6d111ea7 code=0x0 Addtional test: boot guest with "-sandbox off",get same results. Test this bug on an intel host using the following version: qemu-kvm-rhev-2.1.0-3.el7ev.preview.x86_64 kernel-3.10.0-140.el7.x86_64 Steps to Test: 1.Boot guest # /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 QEMU 2.0.92 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver (qemu) info status VM status: running (qemu) Results: qemu-kvm works well and not hang when quit qemu-kvm, qemu-kvm hang, file a new bug bz1126704 Information from BZ #1126704 ... Description of problem: boot a vm with '-sandbox on'+'vnc'+'hda', quit qemu-kvm, qemu-kvm hang. Version-Release number of selected component (if applicable): qemu-kvm-rhev-2.1.0-3.el7ev.preview.x86_64 kernel-3.10.0-140.el7.x86_64 libseccomp-2.1.1-2.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. boot a vm with '-sandbox on'+'vnc'+'hda' # strace -o strace_sandbox_on.txt /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 2. quit qemu-kvm (qemu) q 3. Actual results: after step1, qemu-kvm works well QEMU 2.0.92 monitor - type 'help' for more information (qemu) pulseaudio: pa_context_connect() failed pulseaudio: Reason: Connection refused pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver (qemu) info status VM status: running after step2, qemu-kvm hang # ps -ef |grep qemu root 19784 6288 0 13:55 pts/0 00:00:00 strace -o strace_sandbox_on.txt /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 root 19931 19784 24 13:55 pts/0 00:00:02 [qemu-kvm] <defunct> root 32352 23407 0 13:55 pts/1 00:00:00 grep --color=auto qemu # ausearch -m SECCOMP ---- time->Tue Aug 5 13:25:52 2014 type=SECCOMP msg=audit(1407216352.200:1587): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=914 comm="qemu-kvm" sig=31 syscall=149 compat=0 ip=0x7f7b6d111ea7 code=0x0 ---- time->Tue Aug 5 13:41:45 2014 type=SECCOMP msg=audit(1407217305.536:1588): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=24124 comm="qemu-kvm" sig=31 syscall=66 compat=0 ip=0x7faa42cfec3a code=0x0 ---- time->Tue Aug 5 13:46:00 2014 type=SECCOMP msg=audit(1407217560.084:1589): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=22409 comm="qemu-kvm" sig=31 syscall=66 compat=0 ip=0x7fbb0a27bc3a code=0x0 ---- time->Tue Aug 5 13:47:03 2014 type=SECCOMP msg=audit(1407217623.757:1590): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=15252 comm="qemu-kvm" sig=31 syscall=66 compat=0 ip=0x7f13e2f0ac3a code=0x0 ---- time->Tue Aug 5 13:51:54 2014 type=SECCOMP msg=audit(1407217914.975:1591): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=20845 comm="qemu-kvm" sig=31 syscall=66 compat=0 ip=0x7f54a16e1c3a code=0x0 ---- time->Tue Aug 5 13:55:45 2014 type=SECCOMP msg=audit(1407218145.647:1592): auid=0 uid=0 gid=0 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=19931 comm="qemu-kvm" sig=31 syscall=66 compat=0 ip=0x7fe3b805ec3a code=0x0 Expected results: qemu-kvm can quit normally. Additional info: The host has an audio device: # lspci | grep Audio 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04) Let's keep the above problem with this BZ so we can retain the BZ history, there is no need to create a new BZ. I'm going to close the other BZ as a duplicate of this BZ. *** Bug 1126704 has been marked as a duplicate of this bug. *** The latest offending syscall: # scmp_sys_resolver -a x86_64 66 semctl ... we probably want to add some other sem*() syscalls as well. Created attachment 926521 [details]
01-seccomp-sem_updates.patch
Could you verify the patch above solves your problem? If it does I'll submit it upstream. Upstream patch posting: * http://marc.info/?l=qemu-devel&m=140803679515013&w=2 Upstream commit ID: * b22876cc2f863c58cfebd4a5301fc47e8ec89228 Fix included in qemu-kvm-1.5.3-77.el7 Reproduce this bug on qemu-kvm-1.5.3-36.el7.x86_64. Host: qemu-kvm-1.5.3-36.el7.x86_64 qemu-kvm-debuginfo-1.5.3-36.el7.x86_64 qemu-img-1.5.3-36.el7.x86_64 qemu-kvm-tools-1.5.3-36.el7.x86_64 qemu-kvm-common-1.5.3-36.el7.x86_64 kernel-3.10.0-193.el7.x86_64 Steps: 1. Start qemu with follow command line: [root@intel-e31225-8-1 ~]# /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 Result: qemu-kvm hang. [root@intel-e31225-8-2 ~]# ps ax |grep qemu 2044 pts/2 Zl+ 0:00 [qemu-kvm] <defunct> 2065 pts/1 S+ 0:00 grep --color=auto qemu [root@intel-e31225-8-2 ~]# ausearch -m SECCOMP ---- time->Mon Nov 3 14:38:26 2014 type=SECCOMP msg=audit(1414996706.807:6396): auid=0 uid=0 gid=0 ses=854 pid=2044 comm="qemu-kvm" sig=31 arch=c000003e syscall=83 compat=0 ip=0x7f06b8639637 code=0x0 [root@intel-e31225-8-2 ~]# scmp_sys_resolver 31 shmctl Verified this bug on qemu-kvm-1.5.3-77.el7.x86_64. host: qemu-kvm-debuginfo-1.5.3-77.el7.x86_64 qemu-img-1.5.3-77.el7.x86_64 qemu-kvm-tools-1.5.3-77.el7.x86_64 qemu-kvm-common-1.5.3-77.el7.x86_64 qemu-kvm-1.5.3-77.el7.x86_64 kernel-3.10.0-193.el7.x86_64 Result: Start qemu-kvm with '-sandbox on'+'vnc'+'hda', qemu-kvm works well, then quit normally. So this bug has been fixed. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-0349.html |
Created attachment 819116 [details] strace-sandbox.txt Description of problem: qemu-kvm hang when use '-sandbox on'+'vnc'+'hda' Version-Release number of selected component (if applicable): kernel-3.10.0-40.el7.x86_64 qemu-kvm-rhev-1.5.3-11.el7.x86_64 How reproducible: Always (except first boot guest after reboot host) Steps to Reproduce: 1. /usr/libexec/qemu-kvm -monitor stdio -sandbox on -device intel-hda -device hda-duplex -vnc :0 2. 3. Actual results: qemu-kvm hang Expected results: qemu-kvm works well Additional info: 1. # ps aux | grep qemu root 2320 0.0 0.0 113140 1292 pts/1 S+ 18:58 0:00 sh qemu.sh root 2321 0.8 0.0 0 0 pts/1 Zl+ 18:58 0:00 [qemu] <defunct> 2. This bug can't be reproduced with the following situations: (1) without soundcard (2) use spice instead of vnc