[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoeS3R4HE1fRkonT@casper.infradead.org>
Date: Fri, 20 May 2022 14:08:45 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Laight <David.Laight@...lab.com>
Cc: 'Kent Overstreet' <kent.overstreet@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...r.kernel.org" <linux-mm@...r.kernel.org>,
"pmladek@...e.com" <pmladek@...e.com>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"senozhatsky@...omium.org" <senozhatsky@...omium.org>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v2 03/28] vsprintf: %pf(%p)
On Fri, May 20, 2022 at 08:03:29AM +0000, David Laight wrote:
> From: Matthew Wilcox
> > Sent: 19 May 2022 22:15
> >
> > On Thu, May 19, 2022 at 09:06:24PM +0000, David Laight wrote:
> > > I suspect this a very good way to blow the kernel stack.
> > > The highest stack use is already very likely to be inside
> > > the printf code in an error path somewhere.
> >
> > ...
> >
> > > Double copying using a temporary buffer isn't the end of the world.
> >
> > How can you hold both of these positions simultaneously?
>
> Mostly you only need a short(ish) buffer to format a single item.
> But even a full line buffer is probably less stack than a
> nested printf call.
> It certainly makes it possible for static analysis to determine
> maximum stack depth.
There are a lot of words in this response. Numbers, please.
> That made me realise that one of the problems doing static
> analysis of stack depth is indirect calls.
> The hashes that (IIRC) fine-ibt add to indirect calls
> and functions make it possible to tie these together.
> So you can determine the worst one of the called functions
> and use it for the stack depth at the call sites.
>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>
Powered by blists - more mailing lists