Subject: linux-next: manual merge of the risc-v and vfs trees with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 15 Oct 2020 11:10:02 +1100

Hi all,

Today's linux-next merge of the risc-v tree got a conflict in:

  arch/x86/lib/getuser.S

between commit:

  ea6f043fc984 ("x86: Make __get_user() generate an out-of-line call")

from Linus' tree and commit:

  47058bb54b57 ("x86: remove address space overrides using set_fs()")

from the risc-v and vfs trees.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/lib/getuser.S
index 2cd902e06062,2f052bc96866..000000000000
--- a/arch/x86/lib/getuser.S
+++ b/arch/x86/lib/getuser.S
@@@ -35,12 -35,19 +35,21 @@@
  #include <asm/smap.h>
  #include <asm/export.h>
  
 +#define ASM_BARRIER_NOSPEC ALTERNATIVE "", "lfence", X86_FEATURE_LFENCE_RDTSC
 +
+ #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
+ 
  	.text
  SYM_FUNC_START(__get_user_1)
- 	mov PER_CPU_VAR(current_task), %_ASM_DX
- 	cmp TASK_addr_limit(%_ASM_DX),%_ASM_AX
+ 	LOAD_TASK_SIZE_MINUS_N(0)
+ 	cmp %_ASM_DX,%_ASM_AX
  	jae bad_get_user
  	sbb %_ASM_DX, %_ASM_DX		/* array_index_mask_nospec() */
  	and %_ASM_DX, %_ASM_AX