The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net] ptp: vmclock: prevent read-only mappings from becoming writable
@ 2026-08-13 17:47 Abdifatah Suruur
  2026-08-18 16:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Abdifatah Suruur @ 2026-08-13 17:47 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, dwmw2, Abdifatah Suruur

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).

Reported-by: Abdifatah Suruur <suruurism@gmail.com>

Fixes: 2050327242269 ("ptp: Add support for the AMZNC10C vmclock device")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>

---
--- a/drivers/ptp/ptp_vmclock.c
+++ b/drivers/ptp/ptp_vmclock.c
@@ -372,6 +372,12 @@
 	if ((vma->vm_flags & (VM_READ|VM_WRITE)) != VM_READ)
 		return -EROFS;
 
+	/*
+	 * Restrict the read-only mapping so it cannot be upgraded to
+	 * writable later with mprotect().
+	 */
+	vm_flags_clear(vma, VM_MAYWRITE);
+
 	if (vma->vm_end - vma->vm_start != PAGE_SIZE || vma->vm_pgoff)
 		return -EINVAL;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ptp: vmclock: prevent read-only mappings from becoming writable
  2026-08-13 17:47 [PATCH net] ptp: vmclock: prevent read-only mappings from becoming writable Abdifatah Suruur
@ 2026-08-18 16:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-18 16:50 UTC (permalink / raw)
  To: Abdifatah Suruur; +Cc: netdev, linux-kernel, dwmw2

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 13 Aug 2026 20:47:07 +0300 you wrote:
> 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).
> 
> [...]

Here is the summary with links:
  - [net] ptp: vmclock: prevent read-only mappings from becoming writable
    https://git.kernel.org/netdev/net/c/a5edadbae57e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-18 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 17:47 [PATCH net] ptp: vmclock: prevent read-only mappings from becoming writable Abdifatah Suruur
2026-08-18 16:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox