|
|
7a3408 |
From dd119a69ea174b96a8e60755ec75c7ed718aa9b9 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <dd119a69ea174b96a8e60755ec75c7ed718aa9b9@dist-git>
|
|
|
7a3408 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
Date: Fri, 7 Aug 2015 17:30:17 +0200
|
|
|
7a3408 |
Subject: [PATCH] virDomainDefParseXML: Check for malicious cpu ids in <numa/>
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1176020
|
|
|
7a3408 |
|
|
|
7a3408 |
Some users think this is a good idea:
|
|
|
7a3408 |
|
|
|
7a3408 |
<vcpu placement='static'>4</vcpu>
|
|
|
7a3408 |
<cpu mode='host-model'>
|
|
|
7a3408 |
<model fallback='allow'/>
|
|
|
7a3408 |
<numa>
|
|
|
7a3408 |
<cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
|
|
|
7a3408 |
<cell id='1' cpus='9-10' memory='2097152' unit='KiB'/>
|
|
|
7a3408 |
</numa>
|
|
|
7a3408 |
</cpu>
|
|
|
7a3408 |
|
|
|
7a3408 |
It's not. Lets therefore introduce a check and discourage them in
|
|
|
7a3408 |
doing so.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 82af954c527e88111b05d50953b80eb4afde4d9a)
|
|
|
7a3408 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/conf/domain_conf.c | 6 ++++++
|
|
|
7a3408 |
1 file changed, 6 insertions(+)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
7a3408 |
index 4fe38ae..54d0651 100644
|
|
|
7a3408 |
--- a/src/conf/domain_conf.c
|
|
|
7a3408 |
+++ b/src/conf/domain_conf.c
|
|
|
7a3408 |
@@ -15047,6 +15047,12 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|
|
7a3408 |
goto error;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
+ if (virDomainNumaGetMaxCPUID(def->numa) >= def->maxvcpus) {
|
|
|
7a3408 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
7a3408 |
+ _("CPU IDs in <numa> exceed the <vcpu> count"));
|
|
|
7a3408 |
+ goto error;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+
|
|
|
7a3408 |
if (virDomainNumatuneParseXML(def->numa,
|
|
|
7a3408 |
def->placement_mode ==
|
|
|
7a3408 |
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|