[PATCH v4 7/7] rust_binder: reject mremap()

From: Carlos Llamas

Date: Tue Sep 01 2026 - 16:55:34 EST


Binder does not support mremap() as it caches the mapping address in
Inner::vma_addr. 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: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/patchset/20260813193433.3318288-1-surenb@xxxxxxxxxx?part=2
Signed-off-by: Carlos Llamas <cmllamas@xxxxxxxxxx>
---
drivers/android/binder/page_range.rs | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/android/binder/page_range.rs b/drivers/android/binder/page_range.rs
index d260b009c184..c6247ba03313 100644
--- a/drivers/android/binder/page_range.rs
+++ b/drivers/android/binder/page_range.rs
@@ -148,9 +148,14 @@ pub(crate) struct ShrinkablePageRange {
EINVAL.to_errno()
}

+unsafe extern "C" fn binder_mremap(_: *mut bindings::vm_area_struct) -> c_int {
+ EINVAL.to_errno()
+}
+
static BINDER_VM_OPS: AssertSync<bindings::vm_operations_struct> = {
let ops = bindings::vm_operations_struct {
may_split: Some(binder_vma_may_split),
+ mremap: Some(binder_mremap),
..pin_init::zeroed()
};
AssertSync(ops)
--
2.55.0.966.g6673acef38-goog