[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220916224741.2269649-1-tadeusz.struk@linaro.org>
Date: Fri, 16 Sep 2022 15:47:41 -0700
From: Tadeusz Struk <tadeusz.struk@...aro.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Tadeusz Struk <tadeusz.struk@...aro.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: [PATCH] usb: mon: make mmapped memory read only
Syzbot found an issue in usbmon where it can corrupt monitor
internal memory causing the usbmon to crash with segfault,
UAF, etc. The reproducer mmaps the /dev/usbmon memory to userspace
and overwrites it with arbitrary data, which causes the issues.
To prevent that explicitly clear the VM_WRITE flag in mon_bin_mmap().
Cc: linux-usb@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Cc: stable@...r.kernel.org
Fixes: 6f23ee1fefdc ("USB: add binary API to usbmon")
Link: https://syzkaller.appspot.com/bug?id=2eb1f35d6525fa4a74d75b4244971e5b1411c95a
Signed-off-by: Tadeusz Struk <tadeusz.struk@...aro.org>
---
drivers/usb/mon/mon_bin.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index f48a23adbc35..f452fc03093c 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1268,6 +1268,7 @@ static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
{
/* don't do anything here: "fault" will set up page table entries */
vma->vm_ops = &mon_bin_vm_ops;
+ vma->vm_flags &= ~VM_WRITE;
vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
vma->vm_private_data = filp->private_data;
mon_bin_vma_open(vma);
--
2.37.3
Powered by blists - more mailing lists