linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* vmalloced stacks on x86_64?
@ 2014-10-25  0:22 Andy Lutomirski
  2014-10-25  2:38 ` H. Peter Anvin
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Andy Lutomirski @ 2014-10-25  0:22 UTC (permalink / raw)
  To: H. Peter Anvin, X86 ML, linux-kernel@vger.kernel.org,
	Linus Torvalds

Is there any good reason not to use vmalloc for x86_64 stacks?

The tricky bits I've thought of are:

 - On any context switch, we probably need to probe the new stack
before switching to it.  That way, if it's going to fault due to an
out-of-sync pgd, we still have a stack available to handle the fault.

 - Any time we change cr3, we may need to check that the pgd
corresponding to rsp is there.  If now, we need to sync it over.

 - For simplicity, we probably want all stack ptes to be present all
the time.  This is fine; vmalloc already works that way.

 - If we overrun the stack, we double-fault.  This should be easy to
detect: any double-fault where rsp is less than 20 bytes from the
bottom of the stack is a failure to deliver a non-IST exception due to
 a stack overflow.  The question is: what do we do if this happens?
We could just panic (guaranteed to work).  We could also try to
recover by killing the offending task, but that might be a bit
challenging, since we're in IST context.  We could do something truly
awful: increment RSP by a few hundred bytes, point RIP at do_exit, and
return from the double fault.

Thoughts?  This shouldn't be all that much code.

--Andy

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-10-27  1:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-25  0:22 vmalloced stacks on x86_64? Andy Lutomirski
2014-10-25  2:38 ` H. Peter Anvin
2014-10-25  4:42   ` Andy Lutomirski
2014-10-26 16:46   ` Eric Dumazet
2014-10-25  9:15 ` Ingo Molnar
2014-10-25 16:05   ` Andy Lutomirski
2014-10-25 22:26 ` Richard Weinberger
2014-10-25 23:16   ` Andy Lutomirski
2014-10-25 23:31     ` Richard Weinberger
2014-10-26 18:16     ` Linus Torvalds
2014-10-26  4:11 ` Frederic Weisbecker
2014-10-26  5:49   ` Andy Lutomirski
2014-10-26 20:29     ` Frederic Weisbecker
2014-10-27  1:12       ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).