OSDN Git Service

x86: reorganize SMAP handling in user space accesses
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Dec 2015 17:45:09 +0000 (09:45 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Dec 2018 20:55:13 +0000 (21:55 +0100)
commitcc8c5450b6d7ac0cbc36d133ffa21a01dd21b3d8
tree056d66a5e7fca89081946355b8c6b6112d059027
parentd0169c04fee013922a272a19f7950439a5e07230
x86: reorganize SMAP handling in user space accesses

commit 11f1a4b9755f5dbc3e822a96502ebe9b044b14d8 upstream.

This reorganizes how we do the stac/clac instructions in the user access
code.  Instead of adding the instructions directly to the same inline
asm that does the actual user level access and exception handling, add
them at a higher level.

This is mainly preparation for the next step, where we will expose an
interface to allow users to mark several accesses together as being user
space accesses, but it does already clean up some code:

 - the inlined trivial cases of copy_in_user() now do stac/clac just
   once over the accesses: they used to do one pair around the user
   space read, and another pair around the write-back.

 - the {get,put}_user_ex() macros that are used with the catch/try
   handling don't do any stac/clac at all, because that happens in the
   try/catch surrounding them.

Other than those two cleanups that happened naturally from the
re-organization, this should not make any difference. Yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/uaccess.h
arch/x86/include/asm/uaccess_64.h