[PATCH] rust_binder: fix setting the extended_error

Alice Ryhl posted 1 patch 1 week, 5 days ago
drivers/android/binder/thread.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] rust_binder: fix setting the extended_error
Posted by Alice Ryhl 1 week, 5 days ago
This code currently copies the ExtendedError struct to the stack,
modifies the copy, and then doesn't modify the original. Thus, fix it.
Clearly nobody actually uses this feature, because nobody noticed that
this is broken until they tried changing userspace to make some errors
fatal.

A test in userspace is being added along with this change.

Cc: stable@vger.kernel.org
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 drivers/android/binder/thread.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index 97d5f31e8fe3..0c74436c4e62 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -1249,9 +1249,9 @@ fn transaction(self: &Arc<Self>, cmd: u32, reader: &mut UserSliceReader) -> Resu
                 info.reply = err.reply;
 
                 {
-                    let mut ee = self.inner.lock().extended_error;
-                    ee.command = err.reply;
-                    ee.param = source.to_errno();
+                    let mut inner = self.inner.lock();
+                    inner.extended_error.command = err.reply;
+                    inner.extended_error.param = source.to_errno();
                 }
 
                 pr_warn!(

---
base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
change-id: 20260527-set-extended-error-e2ca37e0696d

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>
Re: [PATCH] rust_binder: fix setting the extended_error
Posted by Alice Ryhl 1 week, 4 days ago
On Wed, May 27, 2026 at 3:41 PM Alice Ryhl <aliceryhl@google.com> wrote:
>
> This code currently copies the ExtendedError struct to the stack,
> modifies the copy, and then doesn't modify the original. Thus, fix it.
> Clearly nobody actually uses this feature, because nobody noticed that
> this is broken until they tried changing userspace to make some errors
> fatal.
>
> A test in userspace is being added along with this change.
>
> Cc: stable@vger.kernel.org
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>

Hrm, looks like this patch is insufficient.

Alice