From: Carlos Llamas <cmllamas@google.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Christian Brauner" <brauner@kernel.org>,
"Carlos Llamas" <cmllamas@google.com>,
"Alice Ryhl" <aliceryhl@google.com>
Cc: kernel-team@android.com, linux-kernel@vger.kernel.org,
Suren Baghdasaryan <surenb@google.com>,
stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v4 1/7] binder: set VM_DONTEXPAND
Date: Tue, 1 Sep 2026 20:52:41 +0000 [thread overview]
Message-ID: <20260901205250.1638304-2-cmllamas@google.com> (raw)
In-Reply-To: <20260901205250.1638304-1-cmllamas@google.com>
Binder does not support expanding VMAs. It caches the original size
under alloc->buffer_size during mmap() and expanding the VMA would only
result in a wasted virtual range. Set the VM_DONTEXPAND flag to prevent
the vma from being expanded via mremap().
Cc: stable@vger.kernel.org
Fixes: 457b9a6f09f0 ("Staging: android: add binder driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260831224145.169403-1-cmllamas@google.com?part=1
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 8f2ef1bd539f..1b492ed48ea6 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -6056,7 +6056,8 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM);
return -EPERM;
}
- vm_flags_mod(vma, VM_DONTCOPY | VM_MIXEDMAP, VM_MAYWRITE);
+ vm_flags_mod(vma, VM_DONTCOPY | VM_MIXEDMAP | VM_DONTEXPAND,
+ VM_MAYWRITE);
vma->vm_ops = &binder_vm_ops;
vma->vm_private_data = proc;
--
2.55.0.966.g6673acef38-goog
next prev parent reply other threads:[~2026-09-01 20:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 20:52 [PATCH v4 0/7] binder: fix issues with mremap() Carlos Llamas
2026-09-01 20:52 ` Carlos Llamas [this message]
2026-09-01 20:52 ` [PATCH v4 2/7] rust_binder: set VM_DONTEXPAND Carlos Llamas
2026-09-01 20:52 ` [PATCH v4 3/7] binder: forbid vma splitting Carlos Llamas
2026-09-01 20:52 ` [PATCH v4 4/7] rust_binder: " Carlos Llamas
2026-09-01 20:52 ` [PATCH v4 5/7] binder: check vma->vm_start in binder_vma_close() Carlos Llamas
2026-09-02 12:50 ` Alice Ryhl
2026-09-02 16:25 ` Carlos Llamas
2026-09-03 7:57 ` Alice Ryhl
2026-09-03 22:12 ` Carlos Llamas
2026-09-04 9:49 ` Alice Ryhl
2026-09-01 20:52 ` [PATCH v4 6/7] binder: reject mremap() Carlos Llamas
2026-09-01 20:52 ` [PATCH v4 7/7] rust_binder: " Carlos Llamas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901205250.1638304-2-cmllamas@google.com \
--to=cmllamas@google.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=brauner@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.