File 15073504-CVE-2021-3631.patch of Package libvirt
xxxxxxxxxx
1
commit 15073504dbb624d3f6c911e85557019d3620fdb2
2
Author: Daniel P. Berrangé <berrange@redhat.com>
3
Date: Mon Jun 28 13:09:04 2021 +0100
4
5
security: fix SELinux label generation logic
6
7
A process can access a file if the set of MCS categories
8
for the file is equal-to *or* a subset-of, the set of
9
MCS categories for the process.
10
11
If there are two VMs:
12
13
a) svirt_t:s0:c117
14
b) svirt_t:s0:c117,c720
15
16
Then VM (b) is able to access files labelled for VM (a).
17
18
IOW, we must discard case where the categories are equal
19
because that is a subset of many other valid category pairs.
20
21
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/153
22
CVE-2021-3631
23
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
24
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
25
26
Index: libvirt-7.1.0/src/security/security_selinux.c
27
===================================================================
28
--- libvirt-7.1.0.orig/src/security/security_selinux.c
29
+++ libvirt-7.1.0/src/security/security_selinux.c
30
31
VIR_DEBUG("Try cat %s:c%d,c%d", sens, c1 + catMin, c2 + catMin);
32
33
if (c1 == c2) {
34
- mcs = g_strdup_printf("%s:c%d", sens, catMin + c1);
35
+ /*
36
+ * A process can access a file if the set of MCS categories
37
+ * for the file is equal-to *or* a subset-of, the set of
38
+ * MCS categories for the process.
39
+ *
40
+ * IOW, we must discard case where the categories are equal
41
+ * because that is a subset of other category pairs.
42
+ */
43
+ continue;
44
} else {
45
if (c1 > c2) {
46
int t = c1;
47