Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174269535
D59904.id188212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D59904.id188212.diff
View Options
diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c
--- a/usr.sbin/bhyve/virtio.c
+++ b/usr.sbin/bhyve/virtio.c
@@ -182,10 +182,15 @@
char *base;
vq = &vs->vs_queues[vs->vs_curq];
- vq->vq_pfn = pfn;
phys = (uint64_t)pfn << VRING_PFN;
size = vring_size_aligned(vq->vq_qsize);
base = paddr_guest2host(vs->vs_pi->pi_vmctx, phys, size);
+ if (base == NULL) {
+ EPRINTLN("%s: queue %u has invalid GPA %#jx/%#zx",
+ vs->vs_vc->vc_name, vq->vq_num, (uintmax_t)phys, size);
+ return;
+ }
+ vq->vq_pfn = pfn;
/* First page(s) are descriptors... */
vq->vq_desc = (struct vring_desc *)base;
@@ -349,6 +354,13 @@
}
vindir = paddr_guest2host(ctx,
vdir->addr, vdir->len);
+ if (vindir == NULL) {
+ EPRINTLN(
+ "%s: indirect table GPA %#jx/%#x is "
+ "unmappable", name, (uintmax_t)vdir->addr,
+ (u_int)vdir->len);
+ return (-1);
+ }
/*
* Indirects start at the 0th, then follow
* their own embedded "next"s until those run
@@ -780,6 +792,8 @@
goto done;
}
vq = &vs->vs_queues[value];
+ if (!vq_ring_ready(vq))
+ goto done;
if (vq->vq_notify)
(*vq->vq_notify)(DEV_SOFTC(vs), vq);
else if (vc->vc_qnotify)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 9:39 PM (16 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40015378
Default Alt Text
D59904.id188212.diff (1 KB)
Attached To
Mode
D59904: bhyve: Validate VirtIO queue guest addresses
Attached
Detach File
Event Timeline
Log In to Comment