Re: [RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-20 Thread Borislav Petkov
On Mon, Oct 20, 2014 at 10:44:18PM -0700, Andy Lutomirski wrote: > You're exactly correct, or at least you seem to understand it the way I do :) Ok, cool. Now, if I had more time, I'd take a guest and add some debugging code to see when exactly that happens and how prev->context.ldt and next->con

Re: [RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-20 Thread Andy Lutomirski
On Mon, Oct 20, 2014 at 10:41 PM, Borislav Petkov wrote: > On Thu, Oct 16, 2014 at 09:21:42AM -0700, Andy Lutomirski wrote: >> I think it's the same as in the other case in switch_mm. leave_mm does >> cpumask_clear_cpu(cpu, mm_cpumask(active_mm)), and, once that has >> happened, modify_ldt won't s

Re: [RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-20 Thread Borislav Petkov
On Thu, Oct 16, 2014 at 09:21:42AM -0700, Andy Lutomirski wrote: > I think it's the same as in the other case in switch_mm. leave_mm does > cpumask_clear_cpu(cpu, mm_cpumask(active_mm)), and, once that has > happened, modify_ldt won't send an IPI to this CPU. So, if leave_mm > runs, and then anothe

Re: [RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-16 Thread Andy Lutomirski
On Thu, Oct 16, 2014 at 8:49 AM, Borislav Petkov wrote: > On Tue, Oct 14, 2014 at 03:57:37PM -0700, Andy Lutomirski wrote: >> The code is correct, but only for a rather subtle reason. This >> confused me for quite a while when I read switch_mm, so clarify the >> code to avoid confusing other peop

Re: [RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-16 Thread Borislav Petkov
On Tue, Oct 14, 2014 at 03:57:37PM -0700, Andy Lutomirski wrote: > The code is correct, but only for a rather subtle reason. This > confused me for quite a while when I read switch_mm, so clarify the > code to avoid confusing other people, too. > > TBH, I wouldn't be surprised if this code was on

[RFC 3/5] x86: Add a comment clarifying LDT context switching

2014-10-14 Thread Andy Lutomirski
The code is correct, but only for a rather subtle reason. This confused me for quite a while when I read switch_mm, so clarify the code to avoid confusing other people, too. TBH, I wouldn't be surprised if this code was only correct by accident. Signed-off-by: Andy Lutomirski --- arch/x86/incl