Skip to content

Commit e7c42a8

Browse files
committed
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
2 parents df49fd0 + 9cd05ad commit e7c42a8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

arch/x86/include/asm/hyperv-tlfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ union hv_gpa_page_range {
841841
* count is equal with how many entries of union hv_gpa_page_range can
842842
* be populated into the input parameter page.
843843
*/
844-
#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) / \
844+
#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) / \
845845
sizeof(union hv_gpa_page_range))
846846

847847
struct hv_guest_mapping_flush_list {

arch/x86/include/asm/uaccess.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ do { \
284284
__put_user_goto(x, ptr, "l", "k", "ir", label); \
285285
break; \
286286
case 8: \
287-
__put_user_goto_u64((__typeof__(*ptr))(x), ptr, label); \
287+
__put_user_goto_u64(x, ptr, label); \
288288
break; \
289289
default: \
290290
__put_user_bad(); \
@@ -431,8 +431,10 @@ do { \
431431
({ \
432432
__label__ __pu_label; \
433433
int __pu_err = -EFAULT; \
434+
__typeof__(*(ptr)) __pu_val; \
435+
__pu_val = x; \
434436
__uaccess_begin(); \
435-
__put_user_size((x), (ptr), (size), __pu_label); \
437+
__put_user_size(__pu_val, (ptr), (size), __pu_label); \
436438
__pu_err = 0; \
437439
__pu_label: \
438440
__uaccess_end(); \

0 commit comments

Comments
 (0)