Thread View: muc.lists.freebsd.bugs
1 messages
1 total messages
Started by bugzilla-noreply
Thu, 19 Nov 2026 05:48
[Bug 300889] xen/gntdev: SET_UNMAP_NOTIFY allocates sizeof(*arg) (16 bytes) for a struct notify_data (24 bytes), heap overflow
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 05:48
Date: Thu, 19 Nov 2026 05:48
59 lines
4067 bytes
4067 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300889
Bug ID: 300889
Summary: xen/gntdev: SET_UNMAP_NOTIFY allocates sizeof(*arg)
(16 bytes) for a struct notify_data (24 bytes), heap
overflow
Product: Base System
Version: 15.1-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: sablomenkamp@gmail.com
Environment: FreeBSD 15.1-RELEASE amd64 as a PVH domU on Xen 4.20.5-pre (Debian
13 dom0), and as an HVM domU on Qubes OS 4.3 (Xen 4.19). Found while running
Xen's libxenvchan and the Qubes OS qrexec agent. Still present in main 5151bc2
(line numbers below are from that commit).
In gntdev_set_unmap_notify() (sys/dev/xen/gntdev/gntdev.c, lines 900 and 911),
both gref->notify and gmap->notify are allocated with malloc(sizeof(*arg),
...). That is struct ioctl_gntdev_unmap_notify, 16 bytes on amd64. The buffer
then holds a struct notify_data, 24 bytes, which adds notify_evtchn_handle.
copy_notify_helper() writes the handle 8 bytes past the end of the allocation.
Any user who can open /dev/xen/gntdev can trigger it.
How it showed: under qrexec load (hundreds of vchan connections, each using
SET_UNMAP_NOTIFY), a general protection fault in notify(). The register that
should have held the handle contained ASCII text, because the neighbouring
allocation had been overwritten.
Suggested fix: allocate sizeof(struct notify_data) (M_WAITOK | M_ZERO) in both
places. A tested patch against main is available if wanted.
The bug in the previous report is probably why this path was rarely reached
before.
Disclosure: found and analysed with an AI assistant (Claude). The reproduction,
the test runs and the results are from my own machines.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads