public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ke Sun <sunke@kylinos.cn>
Cc: "Dirk Behme" <dirk.behme@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Petr Mladek" <pmladek@suse.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Timur Tabi" <ttabi@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Benno Lossin" <lossin@kernel.org>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Tamir Duberstein" <tamird@gmail.com>,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v7 0/4] rust: Add safe pointer formatting support
Date: Tue, 30 Dec 2025 10:40:54 +0200	[thread overview]
Message-ID: <aVOQFmqZCfZWdKSJ@smile.fi.intel.com> (raw)
In-Reply-To: <CALpAb9Omfq8+KoC6Vwgpi+hzy9RezrG+_FiWVc6xf=71iRDj9w@mail.gmail.com>

On Tue, Dec 30, 2025 at 10:03:17AM +0800, Ke Sun wrote:
> On Mon, Dec 29, 2025 at 10:12 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, Dec 29, 2025 at 03:21:18PM +0800, Ke Sun wrote:
> > > This patch series adds safe pointer formatting support for Rust kernel code,
> > > providing three pointer wrapper types (HashedPtr, RawPtr, RestrictedPtr) that
> > > correspond to C kernel's printk format specifiers %p, %px, and %pK.
> >
> > I didn't get the motivation behind %pK. Also what's about all the extensions
> > we (currently) have?
> 
> I'm implementing a R4L wrapper for the RTC driver and currently only
> need basic pointer printing. %pK is typically used in seqfile to
> export information to userspace.
> 
> All extensions can be implemented by modifying and exporting the
> corresponding functions in C, then adding wrapper types in Rust.
> What's your recommendation on which extensions to prioritize, or
> should we implement them all?

I have no priority list, I just asked for clarification of your roadmap and %pK
case as the latter is quite rare (3 in Documentation, 8 in tools, and 25 otherwise)
and probably shouldn't have existed at all. So, I would rather not advertise it,
may be even mark as deprecated or so on Rust level.

> > > The implementation ensures that raw pointers are automatically hashed when
> > > formatted with {:p}, providing safe default behavior that prevents information
> > > leaks about kernel memory layout. Users can also explicitly use wrapper types
> > > when they need specific formatting behavior.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2025-12-30  8:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29  7:21 [PATCH v7 0/4] rust: Add safe pointer formatting support Ke Sun
2025-12-29  7:21 ` [PATCH v7 1/4] lib/vsprintf: Export functions for Rust " Ke Sun
2025-12-29 10:44   ` Dirk Behme
2025-12-31  2:46     ` Ke Sun
2025-12-31 11:07       ` Alice Ryhl
2025-12-29 14:18   ` Andy Shevchenko
2025-12-29 15:00     ` Ke Sun
2025-12-31 10:04     ` Alice Ryhl
2026-01-01  1:43       ` 孙科
2026-01-01  1:46         ` Alice Ryhl
2025-12-29  7:21 ` [PATCH v7 2/4] rust: kernel: Add pointer wrapper types for safe pointer formatting Ke Sun
2025-12-29  9:03   ` Alice Ryhl
2025-12-29 14:07     ` Ke Sun
2025-12-29  7:21 ` [PATCH v7 3/4] rust: fmt: Default raw pointer formatting to HashedPtr Ke Sun
2025-12-29  7:21 ` [PATCH v7 4/4] docs: rust: Add pointer formatting documentation Ke Sun
2025-12-29 14:11 ` [PATCH v7 0/4] rust: Add safe pointer formatting support Andy Shevchenko
2025-12-30  2:03   ` Ke Sun
2025-12-30  8:40     ` Andy Shevchenko [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=aVOQFmqZCfZWdKSJ@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=a.hindborg@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dirk.behme@gmail.com \
    --cc=gary@garyguo.net \
    --cc=john.ogness@linutronix.de \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sunke@kylinos.cn \
    --cc=tamird@gmail.com \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    /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