Re: [PATCH v15 0/2] rust: Add safe pointer formatting support

Miguel Ojeda <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <CANiq72=hGtRyqcZpEvLB8mS-qpQeCyecruVGXSaPCxFfkzifXA@mail.gmail.com>
On Mon, Aug 10, 2026 at 8:35 AM Ke Sun <[email protected]> wrote:
>
> This series fixes two issues with {:p} pointer formatting:
> - The impl_fmt_adapter_forward! macro destructures self into a local
>   variable, causing {:p} to print a stack address instead of the actual
>   pointer
> - Kernel address leak - {:p} prints raw pointer values, exposing kernel
>   address space layout

Applied (v15, not v16) to `rust-next` -- thanks everyone!

For the first one:

    Cc: [email protected]
    Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")

And for the second, I applied v15 because I didn't want to lose Gary's
review, since the test code significantly changed in v16.

I included some of the suggestions from Gary in v15, taking bits from
v16, plus a minimal fix for the KUnit failure, but we can still
improve the patch, i.e. I would like to see 1) the other things what
Gary suggested (e.g. the extra checks), 2) more tests for the KUnit
failure case that currently early returns (e.g. we can still test the
width etc.).

    [ Fixed KUnit failure when the CRNG is not ready. Then, as suggested,
      replaced the `scnprintf` comment (with v16's), changed width to 100,
      replaced cast with `without_provenance`. - Miguel ]

Cheers,
Miguel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.