Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-22 Thread Al Viro
On Mon, Sep 14, 2020 at 02:53:54PM -0500, Josh Poimboeuf wrote: > Al, > > This depends on Christoph's set_fs() removal patches. Would you be > willing to take this in your tree? in #uaccess.x86 and #for-next

RE: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-15 Thread David Laight
From: Josh Poimboeuf > Sent: 14 September 2020 22:51 > > On Mon, Sep 14, 2020 at 09:23:59PM +, David Laight wrote: > > From: Borislav Petkov > > > Sent: 14 September 2020 18:56 > > > > > > On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > > > > +/* > > > > + * Sanitize a user

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Josh Poimboeuf
On Mon, Sep 14, 2020 at 09:23:59PM +, David Laight wrote: > From: Borislav Petkov > > Sent: 14 September 2020 18:56 > > > > On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > > > +/* > > > + * Sanitize a user pointer such that it becomes NULL if it's not a valid > > > user > >

RE: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread David Laight
From: Borislav Petkov > Sent: 14 September 2020 18:56 > > On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > > +/* > > + * Sanitize a user pointer such that it becomes NULL if it's not a valid > > user > > + * pointer. This prevents speculative dereferences of user-controlled >

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Thomas Gleixner
On Mon, Sep 14 2020 at 14:53, Josh Poimboeuf wrote: > Al, > > This depends on Christoph's set_fs() removal patches. Would you be > willing to take this in your tree? Ack. > On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: >> The x86 uaccess code uses barrier_nospec() in various

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Josh Poimboeuf
Al, This depends on Christoph's set_fs() removal patches. Would you be willing to take this in your tree? On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > The x86 uaccess code uses barrier_nospec() in various places to prevent > speculative dereferencing of user-controlled

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Josh Poimboeuf
On Mon, Sep 14, 2020 at 12:06:56PM -0700, Dan Williams wrote: > > +++ b/arch/x86/include/asm/checksum_32.h > > @@ -49,7 +49,8 @@ static inline __wsum csum_and_copy_from_user(const void > > __user *src, > > might_sleep(); > > if (!user_access_begin(src, len)) > >

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Borislav Petkov
On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > The x86 uaccess code uses barrier_nospec() in various places to prevent > speculative dereferencing of user-controlled pointers (which might be > combined with further gadgets or CPU bugs to leak data). > > There are some issues

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Andrew Cooper
On 14/09/2020 20:27, Josh Poimboeuf wrote: > On Mon, Sep 14, 2020 at 09:21:56PM +0200, Borislav Petkov wrote: >> On Mon, Sep 14, 2020 at 11:48:55AM -0700, Dan Williams wrote: Err, stupid question: can this macro then be folded into access_ok() so that you don't have to touch so many

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Josh Poimboeuf
On Mon, Sep 14, 2020 at 09:21:56PM +0200, Borislav Petkov wrote: > On Mon, Sep 14, 2020 at 11:48:55AM -0700, Dan Williams wrote: > > > Err, stupid question: can this macro then be folded into access_ok() so > > > that you don't have to touch so many places and the check can happen > > >

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Borislav Petkov
On Mon, Sep 14, 2020 at 11:48:55AM -0700, Dan Williams wrote: > > Err, stupid question: can this macro then be folded into access_ok() so > > that you don't have to touch so many places and the check can happen > > automatically? > > I think that ends up with more changes because it changes the

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Dan Williams
On Thu, Sep 10, 2020 at 10:24 AM Josh Poimboeuf wrote: > > The x86 uaccess code uses barrier_nospec() in various places to prevent > speculative dereferencing of user-controlled pointers (which might be > combined with further gadgets or CPU bugs to leak data). > > There are some issues with the

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Dan Williams
On Mon, Sep 14, 2020 at 10:56 AM Borislav Petkov wrote: > > On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > > +/* > > + * Sanitize a user pointer such that it becomes NULL if it's not a valid > > user > > + * pointer. This prevents speculative dereferences of user-controlled

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-14 Thread Borislav Petkov
On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > +/* > + * Sanitize a user pointer such that it becomes NULL if it's not a valid user > + * pointer. This prevents speculative dereferences of user-controlled > pointers > + * to kernel space when access_ok() speculatively returns

Re: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-10 Thread Peter Zijlstra
On Thu, Sep 10, 2020 at 12:22:53PM -0500, Josh Poimboeuf wrote: > The x86 uaccess code uses barrier_nospec() in various places to prevent > speculative dereferencing of user-controlled pointers (which might be > combined with further gadgets or CPU bugs to leak data). > > There are some issues

[PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation

2020-09-10 Thread Josh Poimboeuf
The x86 uaccess code uses barrier_nospec() in various places to prevent speculative dereferencing of user-controlled pointers (which might be combined with further gadgets or CPU bugs to leak data). There are some issues with the current implementation: - The barrier_nospec() in copy_from_user()