|
Message-ID: <CALCETrW9aeSMq7b9OaxnN6zJBnhEDtQ85Q4UC2eoft5v59FvBw@mail.gmail.com> Date: Mon, 27 Jun 2016 10:30:31 -0700 From: Andy Lutomirski <luto@...capital.net> To: Linus Torvalds <torvalds@...ux-foundation.org> Cc: Brian Gerst <brgerst@...il.com>, Andy Lutomirski <luto@...nel.org>, "the arch/x86 maintainers" <x86@...nel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, linux-arch <linux-arch@...r.kernel.org>, Borislav Petkov <bp@...en8.de>, Nadav Amit <nadav.amit@...il.com>, Kees Cook <keescook@...omium.org>, "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, Josh Poimboeuf <jpoimboe@...hat.com>, Jann Horn <jann@...jh.net>, Heiko Carstens <heiko.carstens@...ibm.com> Subject: Re: [PATCH v4 15/29] x86/mm/64: Enable vmapped stacks On Mon, Jun 27, 2016 at 10:28 AM, Linus Torvalds <torvalds@...ux-foundation.org> wrote: > On Mon, Jun 27, 2016 at 8:54 AM, Andy Lutomirski <luto@...capital.net> wrote: >> >> How about: >> >> tsk_stack = (unsigned long)task_stack_page(tsk); >> if (regs->rsp <= tsk_stack + 7*8 && regs->rsp > tsk_stack - PAGE_SIZE) { > > I'm not at all convinced that regs->rsp will be all that reliable > under a double-fault scenario either. I'd be more inclined to trusr > cr2 than the register state. > > It's true that double faults can happen for *other* reasons entirely, > and as such it's not clear that %cr2 is reliable either, but since > this is all just about a printout, I'd rather go that way anyway. Fair enough. The chance that we get #GP-in-#GP or similar while CR2 coincidentally points to the guard page is quite low. I'll add all the details to the comment but I'll leave the code alone. FWIW, the manual only says that CS and RIP are untrustworthy, not that RSP is untrustworthy, but it doesn't specify *what* RSP would contain anywhere I can find. I don't think this is important enough to start harassing the Intel and AMD folks over. --Andy
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.