[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFx1aGsRk_JaODEY3c+-LrbJ1huRSngu2E=Z08ADsiu75g@mail.gmail.com>
Date: Fri, 24 Apr 2015 10:41:07 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>,
Borislav Petkov <bp@...en8.de>,
Denys Vlasenko <vda.linux@...glemail.com>,
Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Oleg Nesterov <oleg@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Will Drewry <wad@...omium.org>,
Kees Cook <keescook@...omium.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86_64, asm: Work around AMD SYSRET SS descriptor
attribute issue
On Fri, Apr 24, 2015 at 10:33 AM, Brian Gerst <brgerst@...il.com> wrote:
>
> To clarify, I was thinking of the CONFIG_PREEMPT case. A nested
> interrupt wouldn't change SS, and IST interrupts can't schedule.
It has absolutely nothing to do with nested interrupts or CONFIG_PREEMPT.
The problem happens simply because
- process A does a system call SS=__KERNEL_DS
- the system call sleeps for whatever reason. SS is still __KERNEL_DS
- process B runs, returns to user space, and takes an interrupt. Now SS=0
- process B is about to return to user space (where the interrupt
happened), but we schedule as part of that regular user-space return.
SS=0
- process A returns to user space using sysret, the SS selector
becomes __USER_DS, but the cached descriptor remains non-present
Notice? No nested interrupts, no CONFIG_PREEMPT, nothing special at all.
The reason Luto's patch fixes the problem is that now the scheduling
from B back to A will reload SS, making it __KERNEL_DS, but more
importantly, fixing the cached descriptor to be the usual present flag
one, which is what the AMD sysret instruction needs.
Or do I misunderstand what you are talking about?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists