* [PATCH] rust_binder: treat ESRCH as BR_DEAD_REPLY instead of BR_FAILED_REPLY
@ 2026-11-18 11:24 Alice Ryhl
2026-11-21 18:36 ` Carlos Llamas
0 siblings, 1 reply; 2+ messages in thread
From: Alice Ryhl @ 2026-11-18 11:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Carlos Llamas
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux, linux-kernel,
stable
When sending a message concurrently with it exiting, the transaction may
fail with ESRCH if the timing is right. Since this is delivered to
userspace as BR_FAILED_REPLY, userspace thinks that something went wrong
with the transaction, but actually the target process just died. This
usually leads to the sender aborting.
Cc: stable@vger.kernel.org
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
drivers/android/binder/error.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/android/binder/error.rs b/drivers/android/binder/error.rs
index acf0aa09c555..00f1519a8d77 100644
--- a/drivers/android/binder/error.rs
+++ b/drivers/android/binder/error.rs
@@ -78,8 +78,12 @@ pub(crate) fn new_frozen_oneway() -> Self {
impl From<Error> for BinderError {
#[track_caller]
fn from(source: Error) -> Self {
+ let reply = match source {
+ ESRCH => BR_DEAD_REPLY,
+ _ => BR_FAILED_REPLY,
+ };
Self {
- reply: BR_FAILED_REPLY,
+ reply,
source: Some(source),
line: ErrorLocation::caller(),
}
---
base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
change-id: 20261029-binder-esrch-is-dead-8109ceb9115c
Best regards,
--
Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rust_binder: treat ESRCH as BR_DEAD_REPLY instead of BR_FAILED_REPLY
2026-11-18 11:24 [PATCH] rust_binder: treat ESRCH as BR_DEAD_REPLY instead of BR_FAILED_REPLY Alice Ryhl
@ 2026-11-21 18:36 ` Carlos Llamas
0 siblings, 0 replies; 2+ messages in thread
From: Carlos Llamas @ 2026-11-21 18:36 UTC (permalink / raw)
To: Alice Ryhl
Cc: Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux, linux-kernel,
stable
On Wed, Nov 18, 2026 at 11:24:25AM +0000, Alice Ryhl wrote:
> When sending a message concurrently with it exiting, the transaction may
> fail with ESRCH if the timing is right. Since this is delivered to
> userspace as BR_FAILED_REPLY, userspace thinks that something went wrong
> with the transaction, but actually the target process just died. This
> usually leads to the sender aborting.
>
> Cc: stable@vger.kernel.org
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
> drivers/android/binder/error.rs | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/android/binder/error.rs b/drivers/android/binder/error.rs
> index acf0aa09c555..00f1519a8d77 100644
> --- a/drivers/android/binder/error.rs
> +++ b/drivers/android/binder/error.rs
> @@ -78,8 +78,12 @@ pub(crate) fn new_frozen_oneway() -> Self {
> impl From<Error> for BinderError {
> #[track_caller]
> fn from(source: Error) -> Self {
> + let reply = match source {
> + ESRCH => BR_DEAD_REPLY,
> + _ => BR_FAILED_REPLY,
> + };
> Self {
> - reply: BR_FAILED_REPLY,
> + reply,
> source: Some(source),
> line: ErrorLocation::caller(),
> }
>
> ---
> base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
> change-id: 20261029-binder-esrch-is-dead-8109ceb9115c
>
> Best regards,
> --
> Alice Ryhl <aliceryhl@google.com>
>
LGTM,
Acked-by: Carlos Llamas <cmllamas@google.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-21 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 11:24 [PATCH] rust_binder: treat ESRCH as BR_DEAD_REPLY instead of BR_FAILED_REPLY Alice Ryhl
2026-11-21 18:36 ` Carlos Llamas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox