Re: [RFC[ Alloc in vsprintf

From: Joe Perches
Date: Sun Jun 26 2022 - 17:02:42 EST


On Sun, 2022-06-26 at 16:51 -0400, Kent Overstreet wrote:
> On Sun, Jun 26, 2022 at 01:39:01PM -0700, Joe Perches wrote:
> > On Sun, 2022-06-26 at 13:19 -0700, Linus Torvalds wrote:
> > > On Sun, Jun 26, 2022 at 12:53 PM Joe Perches <joe@xxxxxxxxxxx> 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>.
>
> Serious question: why are you trying to half-ass just _one_ of these functions
> when I've been working on solving stack allocations in all of them?

Because the stack use in _this_ function is quite large.
Backporting to stable would be trivial.
No so with printbufs.

> if you want to help out instead of just slag what I'm
> doing... well, it'd be nice...

Also nice to _be_ nice.
Honestly Kent, I haven't seen much of that from you.