[PATCH v2 4/5] binder: reject mremap()
From: Carlos Llamas
Date: Mon Aug 31 2026 - 23:07:28 EST
Binder does not support mremap() as it caches the mapping address in
alloc->vm_start. Moving the mapping breaks the IPC communication for the
process and can temporarily leak pages during a shrinker reclaim.
Fix this by explicitly rejecting the .mremap() operation.
Cc: stable@xxxxxxxxxxxxxxx
Fixes: 457b9a6f09f0 ("Staging: android: add binder driver")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/patchset/20260813193433.3318288-1-surenb%40google.com?part=2
Signed-off-by: Carlos Llamas <cmllamas@xxxxxxxxxx>
---
drivers/android/binder.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 3ec3a77af106..76fc2edc1937 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -6035,10 +6035,16 @@ VISIBLE_IF_KUNIT vm_fault_t binder_vm_fault(struct vm_fault *vmf)
}
EXPORT_SYMBOL_IF_KUNIT(binder_vm_fault);
+static int binder_mremap(struct vm_area_struct *vma)
+{
+ return -EINVAL;
+}
+
static const struct vm_operations_struct binder_vm_ops = {
.open = binder_vma_open,
.close = binder_vma_close,
.fault = binder_vm_fault,
+ .mremap = binder_mremap,
};
static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
--
2.55.0.897.gb25b4bd76c-goog