Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-21 Thread Boris Petkov
On November 21, 2018 1:41:37 PM GMT+01:00, Victoria Anosova wrote: >For v4.9 your first fix ( >https://lists.openwall.net/linux-kernel/2016/02/26/299) helped. Can you please not top-post? Thx. That old version is not quite right - see the commit message of the current fix. HTH. -- Sent from

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-21 Thread Boris Petkov
On November 21, 2018 1:41:37 PM GMT+01:00, Victoria Anosova wrote: >For v4.9 your first fix ( >https://lists.openwall.net/linux-kernel/2016/02/26/299) helped. Can you please not top-post? Thx. That old version is not quite right - see the commit message of the current fix. HTH. -- Sent from

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-21 Thread Borislav Petkov
On Wed, Nov 21, 2018 at 11:11:18AM +0500, Victoria Anosova wrote: > Glad this come to kernel. We've already applied this patch. The current version, with the bottom half toggling or the original one with preempt_disable/enable? -- Regards/Gruss, Boris. Good mailing practices for 400: avoid

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-21 Thread Borislav Petkov
On Wed, Nov 21, 2018 at 11:11:18AM +0500, Victoria Anosova wrote: > Glad this come to kernel. We've already applied this patch. The current version, with the bottom half toggling or the original one with preempt_disable/enable? -- Regards/Gruss, Boris. Good mailing practices for 400: avoid

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-20 Thread Borislav Petkov
On Tue, Nov 20, 2018 at 01:25:30PM +, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees:

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-20 Thread Borislav Petkov
On Tue, Nov 20, 2018 at 01:25:30PM +, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees:

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 05:04:10PM +0100, Sebastian Andrzej Siewior wrote: > The sequence >fpu->initialized = 1; /* step A */ >preempt_disable(); /* step B */ >fpu__restore(fpu); >preempt_enable(); > > is racy in regard to a context switch. > For 32bit frames __fpu__restore_sig()

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 05:04:10PM +0100, Sebastian Andrzej Siewior wrote: > The sequence >fpu->initialized = 1; /* step A */ >preempt_disable(); /* step B */ >fpu__restore(fpu); >preempt_enable(); > > is racy in regard to a context switch. > For 32bit frames __fpu__restore_sig()

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 06:31:36PM +0100, Sebastian Andrzej Siewior wrote: > I though about __fpregs_changes_begin() in the last patch of the commit: > > https://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/staging.git/commit/?h=x86_fpu_rtu_v4 Also a good spot - api.h talks about preemption

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 06:31:36PM +0100, Sebastian Andrzej Siewior wrote: > I though about __fpregs_changes_begin() in the last patch of the commit: > > https://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/staging.git/commit/?h=x86_fpu_rtu_v4 Also a good spot - api.h talks about preemption

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Dave Hansen
On 11/19/18 9:27 AM, Borislav Petkov wrote: >>> I was really hoping for code comments. :) >> I though we agreed to make those in the larger series because those >> comments in __fpu__restore_sig() would be removed anyway (as part of the >> series). > Also, over local_bh_disable() does not really

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Dave Hansen
On 11/19/18 9:27 AM, Borislav Petkov wrote: >>> I was really hoping for code comments. :) >> I though we agreed to make those in the larger series because those >> comments in __fpu__restore_sig() would be removed anyway (as part of the >> series). > Also, over local_bh_disable() does not really

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
On 2018-11-19 18:27:43 [+0100], Borislav Petkov wrote: > On Mon, Nov 19, 2018 at 06:11:29PM +0100, Sebastian Andrzej Siewior wrote: > > On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > > > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > > > v1…v2: A more verbose commit as message. >

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
On 2018-11-19 18:27:43 [+0100], Borislav Petkov wrote: > On Mon, Nov 19, 2018 at 06:11:29PM +0100, Sebastian Andrzej Siewior wrote: > > On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > > > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > > > v1…v2: A more verbose commit as message. >

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 06:11:29PM +0100, Sebastian Andrzej Siewior wrote: > On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > > v1…v2: A more verbose commit as message. > > > > I was really hoping for code comments. :) > > I though

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 06:11:29PM +0100, Sebastian Andrzej Siewior wrote: > On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > > v1…v2: A more verbose commit as message. > > > > I was really hoping for code comments. :) > > I though

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Dave Hansen
On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > v1…v2: A more verbose commit as message. I was really hoping for code comments. :)

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Dave Hansen
On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > v1…v2: A more verbose commit as message. I was really hoping for code comments. :)

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > v1…v2: A more verbose commit as message. > > I was really hoping for code comments. :) I though we agreed to make those in the larger series because those comments in

Re: [PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
On 2018-11-19 09:02:45 [-0800], Dave Hansen wrote: > On 11/19/18 8:04 AM, Sebastian Andrzej Siewior wrote: > > v1…v2: A more verbose commit as message. > > I was really hoping for code comments. :) I though we agreed to make those in the larger series because those comments in

[PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
The sequence fpu->initialized = 1; /* step A */ preempt_disable();/* step B */ fpu__restore(fpu); preempt_enable(); is racy in regard to a context switch. For 32bit frames __fpu__restore_sig() prepares the FPU state within fpu->state. To ensure that a context switch

[PATCH v2] x86/fpu: Disable BH while while loading FPU registers in __fpu__restore_sig()

2018-11-19 Thread Sebastian Andrzej Siewior
The sequence fpu->initialized = 1; /* step A */ preempt_disable();/* step B */ fpu__restore(fpu); preempt_enable(); is racy in regard to a context switch. For 32bit frames __fpu__restore_sig() prepares the FPU state within fpu->state. To ensure that a context switch