| str_array_entry "cgroup_controllers"
| str_array_entry "cgroup_device_acl"
| int_entry "seccomp_sandbox"
+ | str_array_entry "namespaces"
let save_entry = str_entry "save_image_format"
| str_entry "dump_image_format"
# Defaults to 4
#
#gluster_debug_level = 9
+
+# To enhance security, QEMU driver is capable of creating private namespaces
+# for each domain started. Well, so far only "mount" namespace is supported. If
+# enabled it means qemu process is unable to see all the devices on the system,
+# only those configured for the domain in question. Libvirt then manages
+# devices entries throughout the domain lifetime. This namespace is turned on
+# by default.
+#namespaces = [ "mount" ]
cfg->glusterDebugLevel = 4;
cfg->stdioLogD = true;
+ if (!(cfg->namespaces = virBitmapNew(QEMU_DOMAIN_NS_LAST)))
+ goto error;
+
+ if (virBitmapSetBit(cfg->namespaces, QEMU_DOMAIN_NS_MOUNT) < 0)
+ goto error;
+
#ifdef DEFAULT_LOADER_NVRAM
if (virFirmwareParseList(DEFAULT_LOADER_NVRAM,
&cfg->firmwares,
{
virQEMUDriverConfigPtr cfg = obj;
+ virBitmapFree(cfg->namespaces);
virStringListFree(cfg->cgroupDeviceACL);
char **hugetlbfs = NULL;
char **nvram = NULL;
char *corestr = NULL;
+ char **namespaces = NULL;
/* Just check the file is readable before opening it, otherwise
* libvirt emits an error.
if (virConfGetValueUInt(conf, "gluster_debug_level", &cfg->glusterDebugLevel) < 0)
goto cleanup;
+ if (virConfGetValueStringList(conf, "namespaces", false, &namespaces) < 0)
+ goto cleanup;
+
+ if (namespaces) {
+ virBitmapClearAll(cfg->namespaces);
+
+ for (i = 0; namespaces[i]; i++) {
+ int ns = qemuDomainNamespaceTypeFromString(namespaces[i]);
+
+ if (ns < 0) {
+ virReportError(VIR_ERR_CONF_SYNTAX,
+ _("Unknown namespace: %s"),
+ namespaces[i]);
+ goto cleanup;
+ }
+
+ if (virBitmapSetBit(cfg->namespaces, ns) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to enable namespace: %s"),
+ namespaces[i]);
+ goto cleanup;
+ }
+ }
+ }
+
ret = 0;
cleanup:
char **devMountsPath = NULL;
size_t ndevMountsPath = 0, i;
- if (!virQEMUDriverIsPrivileged(driver)) {
+ if (!virBitmapIsBitSet(cfg->namespaces, QEMU_DOMAIN_NS_MOUNT) ||
+ !virQEMUDriverIsPrivileged(driver)) {
ret = 0;
goto cleanup;
}