From: Carlos Llamas <cmllamas@google.com>
To: Hui Peng <benquike@gmail.com>
Cc: gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com,
brauner@kernel.org, aliceryhl@google.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] binder: fix sender fd 0 close and file refcount leak on TF_UPDATE_TXN
Date: Wed, 23 Sep 2026 22:32:18 +0000 [thread overview]
Message-ID: <arRTcvuJ09EKWnAe@google.com> (raw)
In-Reply-To: <20260919213648.3316566-1-benquike@gmail.com>
On Sat, Sep 19, 2026 at 09:36:48PM +0000, Hui Peng wrote:
> In `binder_proc_transaction()`, when a oneway transaction with
> `TF_UPDATE_TXN` supersedes an outdated pending transaction
> (`t_outdated`), the driver calls `binder_release_entire_buffer(proc,
> NULL, buffer, false)` and `kfree(t_outdated)`.
>
> Passing `is_failure = false` while `buffer->transaction` has already
> been set to `NULL` causes two bugs when `t_outdated` contained
> `BINDER_TYPE_FDA` or `BINDER_TYPE_FD` objects:
>
> 1. For `BINDER_TYPE_FDA`, `binder_translate_fd_array()` never wrote
> recipient file descriptors into the buffer (it only appended `struct
> file *` entries to `t_outdated->fd_fixups`), so the FD array in
> `buffer` still contains zeros (or sender-supplied offsets). Because
> `is_failure` is `false`, `binder_transaction_buffer_release()`
> executes the `!is_failure` branch on `BINDER_TYPE_FDA` and calls
> `binder_deferred_fd_close(fd)` (closing `fd 0` in `current->files`,
> which is the **sender** process!).
> 2. `t_outdated` is freed via `kfree(t_outdated)` without calling
> `binder_free_txn_fixups(t_outdated)`, permanently leaking every
> translated `struct file` reference in `t_outdated->fd_fixups`.
>
> Pass `is_failure = true` to `binder_release_entire_buffer()` and call
> `binder_free_txn_fixups(t_outdated)` before freeing `t_outdated`.
>
> Fixes: 9864bb480133 ("Binder: add TF_UPDATE_TXN to replace outdated txn")
> Fixes: bdc1c5fac982 ("binder: fix UAF caused by faulty buffer cleanup")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
It looks like this has also already been resolved by:
https://lore.kernel.org/all/20260812195316.259136-3-tomerpo@gmail.com/
prev parent reply other threads:[~2026-09-23 22:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 21:36 [PATCH] binder: fix sender fd 0 close and file refcount leak on TF_UPDATE_TXN Hui Peng
2026-09-20 5:00 ` Greg KH
2026-09-20 5:00 ` Greg KH
2026-09-23 22:32 ` Carlos Llamas [this message]
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=arRTcvuJ09EKWnAe@google.com \
--to=cmllamas@google.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=benquike@gmail.com \
--cc=brauner@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--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.