Re: [RFC][PATCH] printf: Harden accessing pointer dereference in vsprintf()
From: Steven Rostedt
Date: Mon Jan 06 2025 - 21:28:13 EST
On Mon, 6 Jan 2025 15:29:01 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 6 Jan 2025 at 14:25, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > Linus had suggested adding this kind of check[1]. This is a bit different
> > than Linus's solution as it utilizes copy_from_kernel_nofault() and doesn't
> > require calls to pagefault_disable() and extra labels.
>
> Yeah, and it generates horrendous code as a result.
>
I guess the question is do we prefer horrendous code generated or what we see?
vsprintf() is used in critical paths, but I wonder how much these two
versions actually make a difference in performance? If they do, then yeah,
the open coded version would be better.
-- Steve