Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionDaniel Berrangé
2017-09-18 09:36:48 UTC
Description of problem:
Historically seccomp feature in QEMU has maintained a giant whitelist of syscalls to allow every feature builtin to QEMU to work. This offered little security benefit (because things like execve are allowed), and at the same time was unreliable (because no one was sure what syscalls 3rd party libraries needed), so was not something that could be enabled by default.
In QEMU 2.11, the seccomp feature has been changed to use modular blacklists. By default only a small set of syscalls are blocked, so this can safely be enabled with near zero risk of breaking any part of QEMU. To allow useful security policy to be enabled, you can opt-in to blocking further syscalls. In particular its possible to block the ability to execve other programs, or elevate privileges via setuid.
Since libvirt never relies on QEMU's ifup helper, or setuid bridge helper, etc it can safely block execve + elevated privileges in seccomp .
This would give us a moderately useful seccomp policy for QEMU out of the box.
Patches:
https://lists.gnu.org/archive/html/qemu-devel/2017-09/msg04072.html
Background:
https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg03348.html
Pushed as:
commit 3527f9dde67460e9f2d50ce52b8dade8c0848e86
Author: Ján Tomko <jtomko>
CommitDate: 2018-04-17 16:29:38 +0200
qemu: deny privilege elevation and spawn in seccomp
If QEMU uses a seccomp blacklist (since 2.11), -sandbox on
no longer tries to whitelist all the calls, but uses sets
of blacklists:
default (always blacklisted with -sandbox on)
obsolete (defaults to deny)
elevateprivileges (setuid & co, default: allow)
spawn (fork & execve, default: allow)
resourcecontrol (setaffinity, setscheduler, default: allow)
If these are supported, default to sandbox with all four
categories blacklisted.
https://bugzilla.redhat.com/show_bug.cgi?id=1492597
Signed-off-by: Ján Tomko <jtomko>
Reviewed-by: John Ferlan <jferlan>
Reviewed-by: Daniel P. Berrangé <berrange>
git describe: v4.2.0-258-g3527f9dde6
Verified with libvirt-4.5.0-7.el7.x86_64 and qemu-kvm-rhev-2.12.0-11.el7.x86_64.
Test steps:
1.Check the default seccomp config in qemu.conf, seccomp is enabled by default:
#cat /etc/libvirt/qemu.conf
# Use seccomp syscall sandbox in QEMU.
# 1 == seccomp enabled, 0 == seccomp disabled
#
# If it is unset (or -1), then seccomp will be enabled
# only if QEMU >= 2.11.0 is detected, otherwise it is
# left disabled. This ensures the default config gets
# protection for new QEMU using the blacklist approach.
#
#seccomp_sandbox = 1
2.Start a guest and check the qemu cmd line:
#ps aux | grep -i sandbox
...-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny ...
3.Disable seccomp config in qemu.conf and restart libvirtd service:
#cat /etc/libvirt/qemu.conf
seccomp_sandbox = 0
#systemctl restart libvirtd
3.Start a guest and check the qemu cmd line:
#ps aux | grep -i sandbox
...-sandbox off...
4.Set seccomp_sandbox to an integer expected 0, then restart libvirtd service, start a guest and check the qemu cmd line, seccomp is enabled as expression described.
5.Set seccomp_sandbox to a char, then restart libvirtd service:
#cat /etc/libvirt/qemu.conf
seccomp_sandbox = a
#systemctl restart libvirtd
#pidof libvirtd
no output
6.Check the error info in syslog:
#cat /var/log/messages
Aug 24 05:18:09 dell-per730-44 libvirtd: 137449: error : virConfParseValue:531 : configuration file syntax error: /etc/libvirt/qemu.conf:680: expecting a value
Aug 24 05:18:09 dell-per730-44 libvirtd: 137449: error : virStateInitialize:667 : Initialization of QEMU state driver failed: configuration file syntax error: /etc/libvirt/qemu.conf:680: expecting a value
Aug 24 05:18:09 dell-per730-44 libvirtd: 137449: error : daemonRunStateInit:806 : Driver state initialization failed
7.Also test do migration between host enable seccomp and disable seccomp, the test results are expected.
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://access.redhat.com/errata/RHSA-2018:3113