Messages in this thread | | | From | Marco Elver <> | Date | Thu, 9 Dec 2021 13:58:35 +0100 | Subject | Re: randomize_kstack: To init or not to init? |
| |
On Thu, 9 Dec 2021 at 11:27, Peter Zijlstra <peterz@infradead.org> wrote: > On Thu, Dec 09, 2021 at 10:58:01AM +0100, Marco Elver wrote: [...] > > 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. > > > 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.
| |