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:   Sun, 26 Jun 2022 13:19:21 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        David Laight <David.Laight@...lab.com>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Matthew Wilcox <willy@...radead.org>,
        Miguel Ojeda <ojeda@...nel.org>,
        Kent Overstreet <kent.overstreet@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>
Subject: Re: [RFC[ Alloc in vsprintf

On Sun, Jun 26, 2022 at 12:53 PM Joe Perches <joe@...ches.com> wrote:
>
> In a reply to the printbufs thread, I wrote a proposal to use an
> alloc to reduce stack in vsprintf when CONFIG_KALLSYMS is enabled.
>
> No one has replied to this but I think it's somewhat sensible.

I think that's a bad idea.

Those things are *literally* called from panic situations, which may
be while holding core memory allocation locks, or similar.

The last thing we want to do is make a hard-to-debug panic be even
*harder* to debug because you get a deadlock when oopsing.

(And yes, I realize that the symbol name lookup can have problems too,
but thats' kind of fundamental to %pS, while a kzmalloc isn't.

Now, you are correct that the stack buffer is annoying. But I think
the proper way to fix that is to say "we already *have* the target
buffer, let's use it".

That does require teaching the sprint_symbol() functions that they
need to take a "length of buffer" and return how much they used, but
that would seem to be a sensible thing anyway, and what the code
should always have done?

It's bad policy to just pass in a buffer without length, and I think
it was always broken. Nasty. That KSYM_SYMBOL_LEN is magically taking
care of it all, but it's ugly as heck, wouldn't you say?

NOTE! The attached patch is completely broken.  I did not do that
interface change to the kallsyms code. The patch is literally meant to
be just an explanation of what I mean, not a working patch.

                  Linus

View attachment "patch.diff" of type "text/x-patch" (1434 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ