Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()
From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2024-10-20 23:14:51
From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2024-10-20 23:14:51
On Sun, Oct 20, 2024 at 04:11:25PM -0700, Josh Poimboeuf wrote:
#define FORCE_CANONICAL \ ALTERNATIVE_2 \ "shl $(64 - 48), %rdx", \ "shl $(64 - 57), %rdx", X86_FEATURE_LA57, \
^^^^ these should be rax
"", ALT_NOT(X86_FEATURE_LAM) #ifdef CONFIG_X86_5LEVEL #define LOAD_TASK_SIZE_MINUS_N(n) \ ALTERNATIVE __stringify(mov $((1 << 47) - 4096 - (n)),%rdx), \ __stringify(mov $((1 << 56) - 4096 - (n)),%rdx), X86_FEATURE_LA57 #else #define LOAD_TASK_SIZE_MINUS_N(n) \ mov $(TASK_SIZE_MAX - (n)),%_ASM_DX #endif .macro check_range size .if IS_ENABLED(CONFIG_X86_64) FORCE_CANONICAL /* If above TASK_SIZE_MAX, convert to all 1's */ LOAD_TASK_SIZE_MINUS_N(size-1) cmp %rax, %rdx sbb %rdx, %rdx or %rdx, %rax
-- Josh