lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 Feb 2022 11:36:58 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Rasmus Villemoes' <linux@...musvillemoes.dk>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Miguel Ojeda <ojeda@...nel.org>
CC:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Gary Guo <gary@...yguo.net>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...gle.com>,
        "Petr Mladek" <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        "Sergey Senozhatsky" <senozhatsky@...omium.org>
Subject: RE: [PATCH v4 12/20] vsprintf: add new `%pA` format specifier

From: Rasmus Villemoes
> Sent: 14 February 2022 10:53
> 
> On 14/02/2022 11.18, Andy Shevchenko wrote:
> > On Sat, Feb 12, 2022 at 02:03:38PM +0100, Miguel Ojeda wrote:
> >
> >> From: Gary Guo <gary@...yguo.net>
> >
> > Not sure I understand this...
> >
> >> 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.
> >>
> >> Co-developed-by: Alex Gaynor <alex.gaynor@...il.com>
> >> Signed-off-by: Alex Gaynor <alex.gaynor@...il.com>
> >> Co-developed-by: Wedson Almeida Filho <wedsonaf@...gle.com>
> >> Signed-off-by: Wedson Almeida Filho <wedsonaf@...gle.com>
> >
> >> Signed-off-by: Gary Guo <gary@...yguo.net>
> >
> > ...together with this in the current SoB chain.
> >
> >> Co-developed-by: Miguel Ojeda <ojeda@...nel.org>
> >> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
> >
> > I'm wondering if you considered to use %pV.
> >
> 
> I think the point is for vsnprintf() to call (back) into Rust code.

Doesn't that stand a reasonable chance of blowing the kernel stack?

vsnprintf() is likely to be on the 'worst case' stack path anyway.
Anything vaguely like a recursive call, or anything 'stack expensive'
inside vsnprintf() stands a real chance of overflowing the stack.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ