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, 20 Jun 2022 23:11:01 -0400
From:   Kent Overstreet <kent.overstreet@...il.com>
To:     David Laight <David.Laight@...LAB.COM>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "pmladek@...e.com" <pmladek@...e.com>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        "enozhatsky@...omium.org" <enozhatsky@...omium.org>,
        "linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
        "willy@...radead.org" <willy@...radead.org>
Subject: Re: [PATCH v4 00/34] Printbufs - new data structure for building
 strings

On Mon, Jun 20, 2022 at 04:19:31AM +0000, David Laight wrote:
> I really think that is a bad idea.
> printk() already uses a lot of stack, anything doing a recursive
> call is just making that worse.
> Especially since these calls can often be in error paths
> which are not often tested and can already be on deep stacks.

So it seems this is something you never actually checked, and I naively assumed
that you might actually know what you were talking about - an understandable
mistake, I think, because vsprintf.c is _a fucking mess_ and high stack usage
would be believable.

But the main part we're concerned with here, snprint() or prt_printf(), has no
such stack usage problems. On v5.18, the frame size is under 64 bytes. On my
branch, it's 72 bytes - higher because we do need to save arguments on the stack
for the pretty-printer invocation, and there's no way around that without
dropping to asm - although I'm allowing up to 8 arguments (besides the printbuf
itself), which is probably excessive.

So I'm not seeing what you're talking about.

In the leaf functions, the individual pretty-printers/%p extensions, those are
doing completely ridiculous things and I have fixed them all except
symbol_string() on my branch, and I'll get to that one.

Having a proper string library with useful helpers really makes things easier,
it turns out.

As for recursive %pf() invocations blowing the stack? I seriously fucking doubt
it, once you're in a pretty-printer where you've already got a printbuf you can
output to there's not much reason to be doing recursive calls to prt_printf()
passing it yet another pretty printer - that's not where %pf() is convenient,
what it makes convenient is using pretty printers when you're calling printk()
directly. In a pretty printer fuction, if you want to do recursive
pretty-printer calls you'd just call it directly! prt_printf(out, "%pf(%p)"),
foo_to_text, foo) is silly when you can just call foo_to_text(out, foo).

Now, I ask both of you please take your bureaucratic nitpicky nonsense and,
kindly, pretty please with sugar on top - stuff it. I much prefer to work with
people who don't waste my time, and who have actual _taste_.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ