1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
From c1f9a268b8ad4b1052843e10960b0d2bf3f702e2 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Wed, 4 May 2016 16:07:02 +0100
Subject: [PATCH 10/14] libxl: Rename READ_BACKEND to READ_LIBXLDEV
We are going to want to change all the functions that use READ_BACKEND
to get untrustworthy information from the backend, to use trustworthy
information from /libxl.
This will involve replacing READ_BACKEND, which reads from be_path,
with a similar macro READ_LIBXLDEV, which reads from libxl_path.
The macro name change generates a lot of clutter in the diff. So we
break it out into this separate patch. Here, we rename the macro, but
the implementation does not really match the new name.
So, another way to look at this, is that we have transformed the bug:
* All of the backends use READ_BACKEND, which is unsafe
into the new bug:
* READ_LIBXLDEV actually reads be_path, which is unsafe.
There is no functional change as yet.
This is part of XSA-178.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
tools/libxl/libxl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 5a9a05e..ed7687b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3039,7 +3039,7 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
libxl_device_nic_init(nic);
-#define READ_BACKEND(tgc, subpath) ({ \
+#define READ_LIBXLDEV(tgc, subpath) ({ \
rc = libxl__xs_read_checked(tgc, XBT_NULL, \
GCSPRINTF("%s/" subpath, be_path), \
&tmp); \
@@ -3047,7 +3047,7 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
(char*)tmp; \
});
- tmp = READ_BACKEND(gc, "handle");
+ tmp = READ_LIBXLDEV(gc, "handle");
if (tmp)
nic->devid = atoi(tmp);
else
@@ -3055,7 +3055,7 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
/* nic->mtu = */
- tmp = READ_BACKEND(gc, "mac");
+ tmp = READ_LIBXLDEV(gc, "mac");
if (tmp) {
rc = libxl__parse_mac(tmp, nic->mac);
if (rc) goto out;
@@ -3063,9 +3063,9 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
memset(nic->mac, 0, sizeof(nic->mac));
}
- nic->ip = READ_BACKEND(NOGC, "ip");
- nic->bridge = READ_BACKEND(NOGC, "bridge");
- nic->script = READ_BACKEND(NOGC, "script");
+ nic->ip = READ_LIBXLDEV(NOGC, "ip");
+ nic->bridge = READ_LIBXLDEV(NOGC, "bridge");
+ nic->script = READ_LIBXLDEV(NOGC, "script");
/* vif_ioemu nics use the same xenstore entries as vif interfaces */
nic->nictype = LIBXL_NIC_TYPE_VIF;
--
1.9.1
|