mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: roll back frozen state and enqueue freeze work on BINDER_FREEZE error
Date: Wed, 23 Sep 2026 22:09:34 +0000	[thread overview]
Message-ID: <arROHg886j_usQk-@google.com> (raw)
In-Reply-To: <20260919213652.3317208-1-benquike@gmail.com>

On Sat, Sep 19, 2026 at 09:36:52PM +0000, Hui Peng wrote:
> Fix two state rollback bugs when `BINDER_FREEZE` fails with `-EAGAIN`:
> 
> 1. In `binder_ioctl_freeze()`, `target_proc->is_frozen = true` is set
>    before waiting for pending transactions to drain. If
>    `wait_event_interruptible_timeout()` times out with `-EAGAIN`,
>    `binder_ioctl_freeze()` resets `target_proc->is_frozen = false` but
>    omits calling `binder_add_freeze_work(target_proc, false)`, leaving
>    any `BINDER_WORK_FROZEN_INFO` state queued during the freeze window
>    un-cleared.

This is incorrect. The current implementation doesn't add the work for
"proc->is_frozen = true" until _after_ the timeout has passed. So adding
another binder_add_freeze_work(target_proc, false) is incorrect.

> 2. In `binder_ioctl()` (`BINDER_FREEZE`), a single PID can own multiple
>    `binder_proc` instances (`target_procs[]`). If
>    `binder_ioctl_freeze()` succeeds on `target_procs[0]` (`is_frozen =
>    true`) and then fails with `-EAGAIN` on `target_procs[1]`, the loop
>    exits and returns `-EAGAIN` to userspace while leaving
>    `target_procs[0]` permanently frozen. Unfreeze any previously frozen
>    `target_procs[0..i-1]` when `binder_ioctl_freeze()` fails.

This is a real issue. However, I'm already fixing this and _other_
issues with this API here:

https://r.android.com/4254406

> 
> Fixes: 432ff1e91694 ("binder: BINDER_FREEZE ioctl")
> Fixes: d579b04a52a1 ("binder: frozen notification")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>

      reply	other threads:[~2026-09-23 22:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 21:36 Hui Peng
2026-09-23 22:09 ` 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=arROHg886j_usQk-@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®