lkml.org 
[lkml]   [2020]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3] x86/uaccess: Use pointer masking to limit uaccess speculation
Date
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 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() was inadvertently removed
>> with: 4b842e4e25b1 ("x86: get rid of small constant size cases in
>> raw_copy_{to,from}_user()")
>>
>> - copy_to_user() and friends should also have a speculation barrier,
>> because a speculative write to a user-controlled address can still
>> populate the cache line with the original data.
>>
>> - The LFENCE in barrier_nospec() is overkill, when more lightweight user
>> pointer masking can be used instead.
>>
>> Remove all existing barrier_nospec() usage, and instead do user pointer
>> masking, throughout the x86 uaccess code. This is similar to what arm64
>> is already doing with uaccess_mask_ptr().
>>
>> barrier_nospec() is now unused, and can be removed.
>>
>> Fixes: 4b842e4e25b1 ("x86: get rid of small constant size cases in raw_copy_{to,from}_user()")
>> Suggested-by: Will Deacon <will@kernel.org>
>> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

\
 
 \ /
  Last update: 2020-09-14 22:52    [W:0.124 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site