Received: from eggs.gnu.org ([2001:4830:134:3::10]:41846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c982t-0000ZA-4z for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:11:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c982i-0002v8-DO for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:11:18 -0500 Received: from indium.canonical.com ([91.189.90.7]:42063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c982i-0002t1-7a for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:11:12 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1c982g-0002ef-8N for ; Tue, 22 Nov 2016 10:11:10 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 3DE732E80C0 for ; Tue, 22 Nov 2016 10:11:10 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Nov 2016 09:59:20 -0000 From: Rafael David Tinoco Reply-To: Bug 1626972 <1626972@bugs.launchpad.net> Sender: bounces@canonical.com References: <20160923110300.23502.55001.malonedeb@soybean.canonical.com> Message-Id: <20161122095920.4970.83085.malone@chaenomeles.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1626972] Re: QEMU memfd_create fallback mechanism change for security drivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Thanks Christian, Then I'll finish this SRU first. Will work in the vhost mmap log file right after. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1626972 Title: QEMU memfd_create fallback mechanism change for security drivers Status in Ubuntu Cloud Archive: In Progress Status in QEMU: In Progress Status in qemu package in Ubuntu: In Progress Status in qemu source package in Xenial: In Progress Status in qemu source package in Yakkety: In Progress Status in qemu source package in Zesty: In Progress Bug description: And, when libvirt starts using apparmor, and creating apparmor profiles for every virtual machine created in the compute nodes, mitaka qemu (2.5 - and upstream also) uses a fallback mechanism for creating shared memory for live-migrations. This fall back mechanism, on kernels 3.13 - that don't have memfd_create() system-call, try to create files on /tmp/ directory and fails.. causing live-migration not to work. Trusty with kernel 3.13 + Mitaka with qemu 2.5 + apparmor capability =3D can't live migrate. From qemu 2.5, logic is on : void *qemu_memfd_alloc(const char *name, size_t size, unsigned int seals,= int *fd) { if (memfd_create)... ### only works with HWE kernels else ### 3.13 kernels, gets blocked by apparmor tmpdir =3D g_get_tmp_dir ... mfd =3D mkstemp(fname) } And you can see the errors: From the host trying to send the virtual machine: 2016-08-15 16:36:26.160 1974 ERROR nova.virt.libvirt.driver [req-0cac612b= -8d53-4610-b773-d07ad6bacb91 691a581cfa7046278380ce82b1c38ddd 133ebc3585c04= 1aebaead8c062cd6511 - - -] [instance: 2afa1131-bc8c-43d2-9c4a-962c1bf7723e]= Migration operation has aborted 2016-08-15 16:36:26.248 1974 ERROR nova.virt.libvirt.driver [req-0cac612b= -8d53-4610-b773-d07ad6bacb91 691a581cfa7046278380ce82b1c38ddd 133ebc3585c04= 1aebaead8c062cd6511 - - -] [instance: 2afa1131-bc8c-43d2-9c4a-962c1bf7723e]= Live Migration failure: internal error: unable to execute QEMU command 'mi= grate': Migration disabled: failed to allocate shared memory From the host trying to receive the virtual machine: Aug 15 16:36:19 tkcompute01 kernel: [ 1194.356794] type=3D1400 audit(1471= 289779.791:72): apparmor=3D"STATUS" operation=3D"profile_load" profile=3D"u= nconfined" name=3D"libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid=3D1256= 5 comm=3D"apparmor_parser" Aug 15 16:36:19 tkcompute01 kernel: [ 1194.357048] type=3D1400 audit(1471= 289779.791:73): apparmor=3D"STATUS" operation=3D"profile_load" profile=3D"u= nconfined" name=3D"qemu_bridge_helper" pid=3D12565 comm=3D"apparmor_parser" Aug 15 16:36:20 tkcompute01 kernel: [ 1194.877027] type=3D1400 audit(1471= 289780.311:74): apparmor=3D"STATUS" operation=3D"profile_replace" profile= =3D"unconfined" name=3D"libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid= =3D12613 comm=3D"apparmor_parser" Aug 15 16:36:20 tkcompute01 kernel: [ 1194.904407] type=3D1400 audit(1471= 289780.343:75): apparmor=3D"STATUS" operation=3D"profile_replace" profile= =3D"unconfined" name=3D"qemu_bridge_helper" pid=3D12613 comm=3D"apparmor_pa= rser" Aug 15 16:36:20 tkcompute01 kernel: [ 1194.973064] type=3D1400 audit(1471= 289780.407:76): apparmor=3D"DENIED" operation=3D"mknod" profile=3D"libvirt-= 2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name=3D"/tmp/memfd-tNpKSj" pid=3D1262= 5 comm=3D"qemu-system-x86" requested_mask=3D"c" denied_mask=3D"c" fsuid=3D1= 07 ouid=3D107 Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979871] type=3D1400 audit(1471= 289780.411:77): apparmor=3D"DENIED" operation=3D"open" profile=3D"libvirt-2= afa1131-bc8c-43d2-9c4a-962c1bf7723e" name=3D"/tmp/" pid=3D12625 comm=3D"qem= u-system-x86" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D107 ouid=3D0 Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979881] type=3D1400 audit(1471= 289780.411:78): apparmor=3D"DENIED" operation=3D"open" profile=3D"libvirt-2= afa1131-bc8c-43d2-9c4a-962c1bf7723e" name=3D"/var/tmp/" pid=3D12625 comm=3D= "qemu-system-x86" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D107 ouid= =3D0 When leaving libvirt without apparmor capabilities (thus not confining virtual machines on compute nodes, the live migration works as expected, so, clearly, apparmor is stepping into the live migration). I'm sure that virtual machines have to be confined and that this isn't the desired behaviour... To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-archive/+bug/1626972/+subscriptions