Commit e7c42a89 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "Two last minute fixes:

   - Prevent value evaluation via functions happening in the user access
     enabled region of __put_user() (put another way: make sure to
     evaluate the value to be stored in user space _before_ enabling
     user space accesses)

   - Correct the definition of a Hyper-V hypercall constant"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT
  x86/uaccess: Don't leak the AC flag into __put_user() value evaluation
parents df49fd0f 9cd05ad2
...@@ -841,7 +841,7 @@ union hv_gpa_page_range { ...@@ -841,7 +841,7 @@ union hv_gpa_page_range {
* count is equal with how many entries of union hv_gpa_page_range can * count is equal with how many entries of union hv_gpa_page_range can
* be populated into the input parameter page. * be populated into the input parameter page.
*/ */
#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) / \ #define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) / \
sizeof(union hv_gpa_page_range)) sizeof(union hv_gpa_page_range))
struct hv_guest_mapping_flush_list { struct hv_guest_mapping_flush_list {
......
...@@ -284,7 +284,7 @@ do { \ ...@@ -284,7 +284,7 @@ do { \
__put_user_goto(x, ptr, "l", "k", "ir", label); \ __put_user_goto(x, ptr, "l", "k", "ir", label); \
break; \ break; \
case 8: \ case 8: \
__put_user_goto_u64((__typeof__(*ptr))(x), ptr, label); \ __put_user_goto_u64(x, ptr, label); \
break; \ break; \
default: \ default: \
__put_user_bad(); \ __put_user_bad(); \
...@@ -431,8 +431,10 @@ do { \ ...@@ -431,8 +431,10 @@ do { \
({ \ ({ \
__label__ __pu_label; \ __label__ __pu_label; \
int __pu_err = -EFAULT; \ int __pu_err = -EFAULT; \
__typeof__(*(ptr)) __pu_val; \
__pu_val = x; \
__uaccess_begin(); \ __uaccess_begin(); \
__put_user_size((x), (ptr), (size), __pu_label); \ __put_user_size(__pu_val, (ptr), (size), __pu_label); \
__pu_err = 0; \ __pu_err = 0; \
__pu_label: \ __pu_label: \
__uaccess_end(); \ __uaccess_end(); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment