Re: randomize_kstack: To init or not to init?

From
Marco Elver <elver@google.com>
Date
2021-12-09 12:58:50
Also in
lkml, llvm
Reply to
Peter Zijlstra, 2021-12-09
On Thu, 9 Dec 2021 at 11:27, Peter Zijlstra [off-list ref] wrote:
On Thu, Dec 09, 2021 at 10:58:01AM +0100, Marco Elver wrote:
[...]
quoted
There are several options:

      A. Make memset (and probably all other mem-transfer functions)
         noinstr compatible, if that is even possible. This only solves
         problem #2.
While we can shut up objtool real easy, the bigger problem is that
noinstr also excludes things like kprobes and breakpoints and other such
goodness from being placed in the text.
quoted
      B. A workaround could be using a VLA with
         __attribute__((uninitialized)), but requires some restructuring
         to make sure the VLA remains in scope and other trickery to
         convince the compiler to not give up that stack space.

      C. Introduce a new __builtin_alloca_uninitialized().

I think #C would be the most robust solution, but means this would
remain as-is for a while.

Preferences?
I'm with you on C.
Seems simple enough, so I've sent https://reviews.llvm.org/D115440 --
either way, there needs to be support to not initialize alloca'd
memory. Let's see where we end up.
Thread (15 messages) 15 messages, 7 authors, last reply 2021-12-20
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help