All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1626972] [NEW] QEMU memfd_create fallback mechanism change for security drivers
@ 2016-09-23 11:03 Rafael David Tinoco
  2016-09-23 11:04 ` [Qemu-devel] [Bug 1626972] " Rafael David Tinoco
                   ` (44 more replies)
  0 siblings, 45 replies; 75+ messages in thread
From: Rafael David Tinoco @ 2016-09-23 11:03 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

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 =
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 = g_get_tmp_dir
       ...
       mfd = 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 133ebc3585c041aebaead8c062cd6511 - - -] [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 133ebc3585c041aebaead8c062cd6511 - - -] [instance: 2afa1131-bc8c-43d2-9c4a-962c1bf7723e] Live Migration failure: internal error: unable to execute QEMU command 'migrate': 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=1400 audit(1471289779.791:72): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid=12565 comm="apparmor_parser"
Aug 15 16:36:19 tkcompute01 kernel: [ 1194.357048] type=1400 audit(1471289779.791:73): apparmor="STATUS" operation="profile_load" profile="unconfined" name="qemu_bridge_helper" pid=12565 comm="apparmor_parser"
Aug 15 16:36:20 tkcompute01 kernel: [ 1194.877027] type=1400 audit(1471289780.311:74): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid=12613 comm="apparmor_parser"
Aug 15 16:36:20 tkcompute01 kernel: [ 1194.904407] type=1400 audit(1471289780.343:75): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="qemu_bridge_helper" pid=12613 comm="apparmor_parser"
Aug 15 16:36:20 tkcompute01 kernel: [ 1194.973064] type=1400 audit(1471289780.407:76): apparmor="DENIED" operation="mknod" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/tmp/memfd-tNpKSj" pid=12625 comm="qemu-system-x86" requested_mask="c" denied_mask="c" fsuid=107 ouid=107
Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979871] type=1400 audit(1471289780.411:77): apparmor="DENIED" operation="open" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/tmp/" pid=12625 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=107 ouid=0
Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979881] type=1400 audit(1471289780.411:78): apparmor="DENIED" operation="open" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/var/tmp/" pid=12625 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=107 ouid=0

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...

** Affects: qemu
     Importance: Undecided
     Assignee: Rafael David Tinoco (inaddy)
         Status: In Progress

-- 
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 QEMU:
  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 =
  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 = g_get_tmp_dir
         ...
         mfd = 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 133ebc3585c041aebaead8c062cd6511 - - -] [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 133ebc3585c041aebaead8c062cd6511 - - -] [instance: 2afa1131-bc8c-43d2-9c4a-962c1bf7723e] Live Migration failure: internal error: unable to execute QEMU command 'migrate': 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=1400 audit(1471289779.791:72): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid=12565 comm="apparmor_parser"
  Aug 15 16:36:19 tkcompute01 kernel: [ 1194.357048] type=1400 audit(1471289779.791:73): apparmor="STATUS" operation="profile_load" profile="unconfined" name="qemu_bridge_helper" pid=12565 comm="apparmor_parser"
  Aug 15 16:36:20 tkcompute01 kernel: [ 1194.877027] type=1400 audit(1471289780.311:74): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" pid=12613 comm="apparmor_parser"
  Aug 15 16:36:20 tkcompute01 kernel: [ 1194.904407] type=1400 audit(1471289780.343:75): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="qemu_bridge_helper" pid=12613 comm="apparmor_parser"
  Aug 15 16:36:20 tkcompute01 kernel: [ 1194.973064] type=1400 audit(1471289780.407:76): apparmor="DENIED" operation="mknod" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/tmp/memfd-tNpKSj" pid=12625 comm="qemu-system-x86" requested_mask="c" denied_mask="c" fsuid=107 ouid=107
  Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979871] type=1400 audit(1471289780.411:77): apparmor="DENIED" operation="open" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/tmp/" pid=12625 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=107 ouid=0
  Aug 15 16:36:20 tkcompute01 kernel: [ 1194.979881] type=1400 audit(1471289780.411:78): apparmor="DENIED" operation="open" profile="libvirt-2afa1131-bc8c-43d2-9c4a-962c1bf7723e" name="/var/tmp/" pid=12625 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=107 ouid=0

  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/qemu/+bug/1626972/+subscriptions

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2017-08-07 15:02 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 11:03 [Qemu-devel] [Bug 1626972] [NEW] QEMU memfd_create fallback mechanism change for security drivers Rafael David Tinoco
2016-09-23 11:04 ` [Qemu-devel] [Bug 1626972] " Rafael David Tinoco
2016-09-23 11:05 ` Rafael David Tinoco
2016-09-23 13:26 ` Rafael David Tinoco
2016-09-27  3:06 ` [Qemu-devel] [PATCH] util: secure memfd_create fallback mechanism Rafael David Tinoco
2016-09-27  8:36   ` Daniel P. Berrange
2016-09-27 11:01     ` Rafael David Tinoco
2016-09-27 11:13       ` Marc-André Lureau
2016-09-27 11:31         ` Rafael David Tinoco
2016-09-27 12:16         ` Daniel P. Berrange
2016-09-27 12:25           ` Marc-André Lureau
2016-10-03 17:38         ` Rafael David Tinoco
2016-09-27 12:18       ` [Qemu-devel] [Bug 1626972] " Daniel P. Berrange
2016-10-03 15:41         ` Rafael David Tinoco
2016-10-03 17:55           ` Daniel P. Berrange
2016-10-03 18:46             ` Rafael David Tinoco
2016-10-03 19:15               ` Rafael David Tinoco
2016-10-04  8:36                 ` Daniel P. Berrange
2016-10-04 12:18                   ` Rafael David Tinoco
2016-10-04 12:39                     ` Marc-André Lureau
2016-10-04 12:42                       ` Daniel P. Berrange
2016-10-04 13:10                         ` Marc-André Lureau
2016-10-04 13:25                           ` Daniel P. Berrange
     [not found]                             ` <0BC69111-0BFC-444D-8BB4-D99F00D42401@canonical.com>
2016-10-04 13:34                               ` Rafael David Tinoco
2016-10-04 13:50                                 ` Marc-André Lureau
2016-10-04 15:29                                   ` Rafael David Tinoco
2016-10-21  3:03                                     ` Rafael David Tinoco
2016-10-21  3:09                                       ` Rafael David Tinoco
2016-10-21 18:08                                       ` Marc-André Lureau
2016-10-04 13:46                             ` Marc-André Lureau
2016-10-04 13:29                           ` Rafael David Tinoco
2016-09-27  3:30 ` [Qemu-devel] [Bug 1626972] Re: QEMU memfd_create fallback mechanism change for security drivers Rafael David Tinoco
2016-10-22 21:54 ` [Qemu-devel] [Bug 1626972] Fwd: [PATCH] vhost: secure vhost shared log files using argv paremeter Rafael David Tinoco
2016-10-22 21:55 ` Rafael David Tinoco
2016-11-18 10:04 ` [Qemu-devel] [Bug 1626972] Re: QEMU memfd_create fallback mechanism change for security drivers Rafael David Tinoco
2016-11-18 10:06 ` Louis Bouchard
2016-11-18 10:07 ` Rafael David Tinoco
2016-11-18 10:21 ` Rafael David Tinoco
2016-11-18 11:14   ` ChristianEhrhardt
2016-11-18 11:31 ` Billy Olsen
2016-11-18 11:32 ` Rafael David Tinoco
2016-11-22  9:59 ` Rafael David Tinoco
2016-11-22 10:01 ` Rafael David Tinoco
2016-11-22 11:47 ` Rafael David Tinoco
2016-11-22 12:02 ` Rafael David Tinoco
2016-11-22 12:13   ` ChristianEhrhardt
2016-11-22 12:08 ` Rafael David Tinoco
2016-11-22 12:29 ` Rafael David Tinoco
2016-11-22 13:32 ` ChristianEhrhardt
2016-11-23 11:24 ` ChristianEhrhardt
2016-11-23 11:27 ` ChristianEhrhardt
2016-11-23 11:30 ` ChristianEhrhardt
2016-11-23 15:26 ` Launchpad Bug Tracker
2016-11-23 15:46 ` ChristianEhrhardt
2016-11-23 22:38 ` Martin Pitt
2016-11-24  8:35 ` Thomas Huth
2016-11-28 20:36 ` James Page
2016-12-01 14:56 ` James Page
2016-12-01 19:10 ` Brian Murray
2016-12-08  8:49 ` Antonio Messina
2016-12-08  9:29 ` James Page
2016-12-08 11:14 ` Rafael David Tinoco
2016-12-08 11:16 ` Rafael David Tinoco
2017-01-11  3:24 ` Rafael David Tinoco
2017-01-11 13:47 ` Rafael David Tinoco
2017-01-16 11:39 ` Thomas Huth
2017-01-19 16:03 ` Launchpad Bug Tracker
2017-01-19 16:04 ` [Qemu-devel] [Bug 1626972] Update Released Brian Murray
2017-01-23 19:27 ` [Qemu-devel] [Bug 1626972] Re: QEMU memfd_create fallback mechanism change for security drivers ChristianEhrhardt
2017-01-24  0:52 ` Rafael David Tinoco
2017-01-24  7:55   ` ChristianEhrhardt
2017-01-24 11:41 ` Rafael David Tinoco
2017-01-25 10:23 ` Launchpad Bug Tracker
2017-02-15 15:52 ` Rafael David Tinoco
2017-08-07 14:51 ` James Page

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.