From: "Gary Guo" <gary@garyguo.net>
To: "Ke Sun" <sunke@kylinos.cn>, "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>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>
Cc: <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v15 1/2] rust: fmt: fix {:p} printing stack addresses
Date: Mon, 10 Aug 2026 11:48:05 +0100 [thread overview]
Message-ID: <DKL7DIYECV4Y.2K72F6I0KHKNT@garyguo.net> (raw)
In-Reply-To: <20260810-hashedptr-v15-1-eafd27d36476@kylinos.cn>
On Mon Aug 10, 2026 at 7:35 AM BST, Ke Sun wrote:
> The `impl_fmt_adapter_forward!` macro forwards `Pointer` for
> `Adapter<T>` by destructuring `self` into a local `t`, causing `{:p}`
> to print the address of that temporary stack variable rather than the
> actual pointer.
>
> Remove `Pointer` from the macro and provide a manual impl for
> `Adapter<&T>` that passes `self.0` directly.
>
> Signed-off-by: Ke Sun <sunke@kylinos.cn>
I don't think this has changed since last version. Usually you should pick up
all tags provided for the previous series, so people know that it has been
reviewed already and don't need to spend more time correlating it with the
previous series.
(No need to resend just with tags picked up though)
Best,
Gary
> ---
> rust/kernel/fmt.rs | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/rust/kernel/fmt.rs b/rust/kernel/fmt.rs
> index 73afbc51ba33a..cd7d9664ff5b9 100644
> --- a/rust/kernel/fmt.rs
> +++ b/rust/kernel/fmt.rs
> @@ -43,7 +43,14 @@ fn fmt(&self, f: &mut Formatter<'_>) -> Result {
> UpperExp,
> UpperHex, //
> };
> -impl_fmt_adapter_forward!(Debug, LowerHex, UpperHex, Octal, Binary, Pointer, LowerExp, UpperExp);
> +impl_fmt_adapter_forward!(Debug, LowerHex, UpperHex, Octal, Binary, LowerExp, UpperExp);
> +
> +impl<T: ?Sized + Pointer> Pointer for Adapter<&T> {
> + #[inline]
> + fn fmt(&self, f: &mut Formatter<'_>) -> Result {
> + Pointer::fmt(self.0, f)
> + }
> +}
>
> /// A copy of [`core::fmt::Display`] that allows us to implement it for foreign types.
> ///
next prev parent reply other threads:[~2026-08-10 10:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 6:35 [PATCH v15 0/2] rust: Add safe pointer formatting support Ke Sun
2026-08-10 6:35 ` [PATCH v15 1/2] rust: fmt: fix {:p} printing stack addresses Ke Sun
2026-08-10 10:48 ` Gary Guo [this message]
2026-08-10 13:17 ` Ke Sun
2026-08-10 6:35 ` [PATCH v15 2/2] rust: fmt: route {:p} through HashedPtr to prevent address leaks Ke Sun
2026-08-10 10:59 ` Gary Guo
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=DKL7DIYECV4Y.2K72F6I0KHKNT@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sunke@kylinos.cn \
--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