lkml.org 
[lkml]   [2022]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC[ Alloc in vsprintf
From
Date
On Sun, 2022-06-26 at 13:19 -0700, Linus Torvalds wrote:
> On Sun, Jun 26, 2022 at 12:53 PM Joe Perches <joe@perches.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.

Somewhat sensible not sensible...

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

True, and special_hex_number was used on alloc failure.

> 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".

OK, and that's true for all the temp stack buffers in every %p<foo>.

> 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?

Unnecessary stack and/or unnecessary buffers for printbufs are
just unnecessary.

> 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?

Yup.

\
 
 \ /
  Last update: 2022-06-26 22:40    [W:0.224 / U:3.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site