Skip to content

Commit 9996bd4

Browse files
sj-awsjgross1
authored andcommitted
xenbus/xenbus_backend: Disallow pending watch messages
'xenbus_backend' watches 'state' of devices, which is writable by guests. Hence, if guests intensively updates it, dom0 will have lots of pending events that exhausting memory of dom0. In other words, guests can trigger dom0 memory pressure. This is known as XSA-349. However, the watch callback of it, 'frontend_changed()', reads only 'state', so doesn't need to have the pending events. To avoid the problem, this commit disallows pending watch messages for 'xenbus_backend' using the 'will_handle()' watch callback. This is part of XSA-349 Cc: [email protected] Signed-off-by: SeongJae Park <[email protected]> Reported-by: Michael Kurth <[email protected]> Reported-by: Pawel Wieczorkiewicz <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 3dc86ca commit 9996bd4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/xen/xenbus/xenbus_probe_backend.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type,
180180
return err;
181181
}
182182

183+
static bool frontend_will_handle(struct xenbus_watch *watch,
184+
const char *path, const char *token)
185+
{
186+
return watch->nr_pending == 0;
187+
}
188+
183189
static void frontend_changed(struct xenbus_watch *watch,
184190
const char *path, const char *token)
185191
{
@@ -191,6 +197,7 @@ static struct xen_bus_type xenbus_backend = {
191197
.levels = 3, /* backend/type/<frontend>/<id> */
192198
.get_bus_id = backend_bus_id,
193199
.probe = xenbus_probe_backend,
200+
.otherend_will_handle = frontend_will_handle,
194201
.otherend_changed = frontend_changed,
195202
.bus = {
196203
.name = "xen-backend",

0 commit comments

Comments
 (0)