Re: [PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-18 Thread Borislav Petkov
On Thu, Sep 17, 2020 at 02:57:51PM -0700, Luck, Tony wrote: > On Thu, Sep 17, 2020 at 07:04:06PM +0200, Borislav Petkov wrote: > > So actually, I'm thinking: > > > > .LMCE_during_user_access: > > mov $-ENODEV, %eax > > ASM_CLAC > > ret > > > > I have no clue which error code we should

Re: [PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-17 Thread Luck, Tony
On Thu, Sep 17, 2020 at 07:04:06PM +0200, Borislav Petkov wrote: > So actually, I'm thinking: > > .LMCE_during_user_access: > mov $-ENODEV, %eax > ASM_CLAC > ret > > I have no clue which error code we should put there but it should be an > error code which tells you not to retry

Re: [PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-17 Thread Borislav Petkov
Replying a bit out of order: > Both the code and the commit comment need much more of this > description. Hell yeah! On Wed, Sep 16, 2020 at 12:26:59PM -0700, Luck, Tony wrote: > So we take a another machine check on the same address when > fault_in_pages_readable() does __get_user(). That ough

Re: [PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-16 Thread Borislav Petkov
On Tue, Sep 08, 2020 at 10:55:16AM -0700, Tony Luck wrote: > In the page fault case it is ok to see if a few more unaligned bytes > can be copied from the source address. Worst case is that the page fault > will be triggered again. > > Machine checks are more serious. Just give up at the point whe

Re: [PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-16 Thread Luck, Tony
On Wed, Sep 16, 2020 at 12:53:36PM +0200, Borislav Petkov wrote: > On Tue, Sep 08, 2020 at 10:55:16AM -0700, Tony Luck wrote: > > 2: mov %ecx,%eax > > ASM_CLAC > > ret > > +3: xorl %eax,%eax /* pretend we succeeded? */ > > Hmm, but copy_*_user returns the uncopied bytes in eax. Users of

[PATCH 5/8] x86/mce: Avoid tail copy when machine check terminated a copy from user

2020-09-08 Thread Tony Luck
In the page fault case it is ok to see if a few more unaligned bytes can be copied from the source address. Worst case is that the page fault will be triggered again. Machine checks are more serious. Just give up at the point where the main copy loop triggered the #MC and return as if the copy suc