The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Carlos Llamas <cmllamas@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] rust_binder: fix BINDER_GET_EXTENDED_ERROR
Date: Thu, 4 Jun 2026 12:58:26 +0000	[thread overview]
Message-ID: <aiF2cpJKpyj3XFj4@google.com> (raw)
In-Reply-To: <20260604-set-extended-error-v2-1-fb0753e7ab53@google.com>

On Thu, Jun 04, 2026 at 11:37:07AM +0000, Alice Ryhl wrote:
> This code currently copies the ExtendedError struct to the stack,
> modifies the copy, and then doesn't modify the original. Thus, fix it.
> 
> Furthermore, errors when replying must be delivered directly to the
> remote thread, so update deliver_reply() to take an extended error
> argument.
> 
> Cc: stable@vger.kernel.org
> Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>

>              BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
>              BR_FROZEN_REPLY => f.pad("BR_FROZEN_REPLY"),
>              BR_TRANSACTION_PENDING_FROZEN => f.pad("BR_TRANSACTION_PENDING_FROZEN"),
>              BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
> -            _ => f
> -                .debug_struct("BinderError")
> -                .field("reply", &self.reply)
> -                .finish(),
> +            _ => match self.source.as_ref() {
> +                Some(source) => source.fmt(f),
> +                None => f.pad("OTHER_ERROR"),

As sashiko points out, this is probably better as:

	self.reply.fmt(f)

to just print the raw integer.

> -            let reply = Err(BR_FAILED_REPLY);
> -            orig.from.deliver_reply(reply, &orig);
> +
> +            let param = err.source.as_ref().map_or(0, |e| e.to_errno());
> +            let ee = ExtendedError::new(orig.debug_id as u32, err.reply, param);
> +            orig.from
> +                .deliver_reply(Err(BR_FAILED_REPLY), &orig, Some(ee));

As sashiko points out it should be info.debug_id instead of
orig.debug_id here.

Alice

      reply	other threads:[~2026-06-04 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 11:37 [PATCH v2] rust_binder: fix BINDER_GET_EXTENDED_ERROR Alice Ryhl
2026-06-04 12:58 ` Alice Ryhl [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=aiF2cpJKpyj3XFj4@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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