Re: [PATCH v6 14/23] vsprintf: add new `%pA` format specifier

From: Kees Cook
Date: Sat May 07 2022 - 04:19:14 EST


On Sat, May 07, 2022 at 07:24:12AM +0200, Miguel Ojeda wrote:
> From: Gary Guo <gary@xxxxxxxxxxx>
>
> This patch adds a format specifier `%pA` to `vsprintf` which formats
> a pointer as `core::fmt::Arguments`. Doing so allows us to directly
> format to the internal buffer of `printf`, so we do not have to use
> a temporary buffer on the stack to pre-assemble the message on
> the Rust side.
>
> This specifier is intended only to be used from Rust and not for C, so
> `checkpatch.pl` is intentionally unchanged to catch any misuse.

Maybe add a test to yell if pA is seen in a .c file (like the runtime
check in this patch).

But that can be separate from this patch.

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook