linux/arch
Will Deacon 4d1eda771e FROMLIST: x86/uaccess: Fix 32-bit __get_user_asm_u64() when CC_HAS_ASM_GOTO_OUTPUT=y
Commit 865c50e1d2 ("x86/uaccess: utilize CONFIG_CC_HAS_ASM_GOTO_OUTPUT")
added an optimised version of __get_user_asm() for x86 using 'asm goto'.

Like the non-optimised code, the 32-bit implementation of 64-bit get_user()
expands to a pair of 32-bit accesses. Unlike the non-optimised code, the
_original_ pointer is incremented to copy the high word instead of loading
through a new pointer explicitly constructed to point at a 32-bit type.
Consequently, if the pointer points at a 64-bit type then we end up
loading the wrong data for the upper 32-bits.

This was observed as a mount() failure in Android targetting i686 after
b0cfcdd9b9 ("d_path: make 'prepend()' fill up the buffer exactly on
overflow") because the call to copy_from_kernel_nofault() from
prepend_copy() ends up in __get_kernel_nofault() and casts the source
pointer to a 'u64 __user *'. An attempt to mount at "/debug_ramdisk"
therefore ends up failing trying to mount "/debumdismdisk".

Use the existing '__gu_ptr' source pointer to unsigned int for 32-bit
__get_user_asm_u64() instead of the original pointer.

Fixes: 865c50e1d2 ("x86/uaccess: utilize CONFIG_CC_HAS_ASM_GOTO_OUTPUT")
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210913163547.5156-1-will@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I652ecff43caf258bd0aa31e52fdd58f9461b9e46
2021-09-13 18:50:39 +02:00
..
alpha asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
arc asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
arm Merge 4ac6d90867 ("Merge tag 'docs-5.15' of git://git.lwn.net/linux") into android-mainline 2021-09-09 14:00:42 +02:00
arm64 Revert "Revert "ANDROID: GKI: temporarily disable LTO/CFI"" 2021-09-10 22:59:05 +00:00
csky asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols 2021-07-30 10:30:21 +02:00
h8300 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
hexagon asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols 2021-07-30 10:30:21 +02:00
ia64 printk changes for 5.15 2021-09-01 18:41:13 -07:00
m68k m68knommu: collection of fixes for 5.15 2021-09-01 18:31:45 -07:00
microblaze asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
mips printk changes for 5.15 2021-09-01 18:41:13 -07:00
nds32 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
nios2 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
openrisc printk changes for 5.15 2021-09-01 18:41:13 -07:00
parisc asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
powerpc printk changes for 5.15 2021-09-01 18:41:13 -07:00
riscv Devicetree updates for v5.15: 2021-09-01 18:34:51 -07:00
s390 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
sh asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
sparc asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
um printk changes for 5.15 2021-09-01 18:41:13 -07:00
x86 FROMLIST: x86/uaccess: Fix 32-bit __get_user_asm_u64() when CC_HAS_ASM_GOTO_OUTPUT=y 2021-09-13 18:50:39 +02:00
xtensa asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
.gitignore
Kconfig sched: Add task_work callback for paranoid L1D flush 2021-07-28 11:42:24 +02:00