]> git.hungrycats.org Git - linux/commit
ptp: vmclock: prevent read-only mappings from becoming writable
authorAbdifatah Suruur <suruurism@gmail.com>
Thu, 13 Aug 2026 17:47:07 +0000 (20:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Aug 2026 12:32:55 +0000 (14:32 +0200)
commit5b4f2bec7bea6c04084d720d731bedee7caf878d
treef52b5ace08be9a8c856252a3cedc97b02ab662ea
parentdba60d26e9dda3e157ad6b0934d4232f6c6904ee
ptp: vmclock: prevent read-only mappings from becoming writable

commit a5edadbae57e2298a56cf7a4e774a027905a331f upstream.

vmclock_miscdev_mmap() rejects writable mappings of the shared vmclock
ABI page with -EROFS, but leaves VM_MAYWRITE set.  Userspace can map the
page read-only and then upgrade it to writable with mprotect(), after
which the guest can corrupt the host-written timekeeping data (sequence
counter, UTC time, TSC offset) that the vmclock ABI defines as read-only.

Clear VM_MAYWRITE on the read-only path so the mapping cannot be
upgraded, as i915 does for its read-only objects and as fixed in drm/vc4
(CVE-2026-68445) and drm/panthor (CVE-2024-53071).

Cc: stable@vger.kernel.org
Fixes: 205032724226 ("ptp: Add support for the AMZNC10C 'vmclock' device")
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
Link: https://patch.msgid.link/20260813174707.14809-1-suruurism@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ptp/ptp_vmclock.c