Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] IB/hfi1: clear VM_MAYWRITE on read-only STATUS mmap
@ 2026-11-18 12:58 Abdifatah Suruur
  2026-11-18 13:14 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Abdifatah Suruur @ 2026-11-18 12:58 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: linux-rdma, Jason Gunthorpe, Leon Romanovsky, Abdifatah Suruur,
	stable

hfi1_file_mmap() rejects a writable mapping of the device status page,
but leaves VM_MAYWRITE set in the VMA flags. Userspace can map the page
read-only and then upgrade it to writable with mprotect(), bypassing
the check and writing to a device-owned status page.

Clear VM_MAYWRITE on this path, as the RTAIL and SUBCTXT_EGRBUF cases in
the same function already do.

Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>

---
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 680364fda856f..779dbe32c69da 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -492,6 +492,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
 			ret = -EPERM;
 			goto done;
 		}
+		flags &= ~VM_MAYWRITE;
 		memaddr = kvirt_to_phys((void *)dd->status);
 		memlen = PAGE_SIZE;
 		break;

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

end of thread, other threads:[~2026-11-18 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 12:58 [PATCH] IB/hfi1: clear VM_MAYWRITE on read-only STATUS mmap Abdifatah Suruur
2026-11-18 13:14 ` sashiko-bot

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