Re: [PATCH] rust_binder: rollback node refcount state on return command write failure

From: Alice Ryhl

Date: Sun Nov 29 2026 - 05:35:16 EST


On Sat, Nov 28, 2026 at 11:27:15PM +0530, Adhyansh Verma wrote:
> 3. In Binder architecture, an -EFAULT on writing return commands to
> userspace indicates userspace memory corruption or process termination,
> matching the upstream C Binder behavior which does not roll back refcounts
> on return code write failures.
>
> Please discard this patch.

Agreed. In general, if userspace passes an illegal buffer and gets an
-EFAULT, that's fatal and we don't need to be able to recover (as long as
kernel state is still cleaned up safely when the process exits, which
Process::deferred_release() already handles).

The same applies to your other three BR_* write-failure rollback patches:

- rust_binder: decrement requested_thread_count on BR_SPAWN_LOOPER write failure
https://lore.kernel.org/r/20261128153719.143637-1-adhyanshverma2010@xxxxxxxxx
(Note also that C Binder does not decrement proc->requested_threads on
put_user(BR_SPAWN_LOOPER) failure either, and this write can only fail if
userspace concurrently unmaps/protects the buffer after BR_NOOP was written.)

- rust_binder: rollback freeze listener state on BR_FROZEN_BINDER write failure
https://lore.kernel.org/r/20261128194856.53717-1-adhyanshverma2010@xxxxxxxxx

- rust_binder: rollback delivered_deaths and requeue on death notification write failure
https://lore.kernel.org/r/20261128172738.11747-1-adhyanshverma2010@xxxxxxxxx

So I don't think we should take those three patches either.

Alice