linux/arch/x86/lib
Kees Cook 8c860ed825 x86/uaccess: Fix missed zeroing of ia32 u64 get_user() range checking
When reworking the range checking for get_user(), the get_user_8() case
on 32-bit wasn't zeroing the high register. (The jump to bad_get_user_8
was accidentally dropped.) Restore the correct error handling
destination (and rename the jump to using the expected ".L" prefix).

While here, switch to using a named argument ("size") for the call
template ("%c4" to "%c[size]") as already used in the other call
templates in this file.

Found after moving the usercopy selftests to KUnit:

      # usercopy_test_invalid: EXPECTATION FAILED at
      lib/usercopy_kunit.c:278
      Expected val_u64 == 0, but
          val_u64 == -60129542144 (0xfffffff200000000)

Closes: https://lore.kernel.org/all/CABVgOSn=tb=Lj9SxHuT4_9MTjjKVxsq-ikdXC4kGHO4CfKVmGQ@mail.gmail.com
Fixes: b19b74bc99 ("x86/mm: Rework address range check in get_user() and put_user()")
Reported-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Tested-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/all/20240610210213.work.143-kees%40kernel.org
2024-06-11 16:08:43 -07:00
..
.gitignore
atomic64_32.c
atomic64_386_32.S
atomic64_cx8_32.S
cache-smp.c x86: fix missing includes/forward declarations 2023-12-20 16:40:30 -05:00
checksum_32.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
clear_page_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
cmdline.c x86/lib: Fix compiler and kernel-doc warnings 2023-01-03 18:46:21 +01:00
cmpxchg8b_emu.S Linux 6.8-rc4 2024-02-14 10:45:07 +01:00
cmpxchg16b_emu.S x86/percpu: Introduce %rip-relative addressing to PER_CPU_VAR() 2023-10-20 12:19:51 +02:00
copy_mc.c x86: call instrumentation hooks from copy_mc.c 2024-04-25 21:07:02 -07:00
copy_mc_64.S
copy_page_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
copy_user_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
copy_user_uncached_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
cpu.c
csum-copy_64.S
csum-partial_64.c x86/csum: clean up `csum_partial' further 2024-01-04 15:42:30 -08:00
csum-wrappers_64.c x86/lib: Address kernel-doc warnings 2023-10-03 22:46:47 +02:00
delay.c arch/x86: Fix typos 2024-01-03 11:46:22 +01:00
error-inject.c x86/error_inject: Align function properly 2022-10-17 16:40:59 +02:00
getuser.S x86/uaccess: Fix missed zeroing of ia32 u64 get_user() range checking 2024-06-11 16:08:43 -07:00
hweight.S x86 assembly code improvements for v6.7 are: 2023-10-30 14:18:00 -10:00
inat.c
insn-eval.c x86/insn-eval: Fix function param name in get_eff_addr_sib() 2024-02-13 22:41:25 +01:00
insn.c x86/insn: Add support for APX EVEX to the instruction decoder logic 2024-05-02 13:13:45 +02:00
iomem.c
kaslr.c
Makefile x86: Stop using weak symbols for __iowrite32_copy() 2024-04-22 17:11:19 -03:00
memcpy_32.c x86/mem: Move memmove to out of line assembler 2022-11-01 15:44:07 -07:00
memcpy_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
memmove_32.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
memmove_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
memset_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
misc.c x86/lib: Fix overflow when counting digits 2023-11-17 06:26:14 -08:00
msr-reg-export.c
msr-reg.S
msr-smp.c x86/msr: Add missing __percpu annotations 2024-03-04 12:01:54 +01:00
msr.c x86/msr: Add missing __percpu annotations 2024-03-04 12:01:54 +01:00
pc-conf-reg.c
putuser.S x86/lib: Revert to _ASM_EXTABLE_UA() for {get,put}_user() fixups 2024-01-29 11:40:41 +01:00
retpoline.S x86/retpolines: Enable the default thunk warning only on relevant configs 2024-04-17 18:02:05 +02:00
string_32.c
strstr_32.c
usercopy.c x86/uaccess: instrument copy_from_user_nmi() 2022-11-08 15:57:24 -08:00
usercopy_32.c
usercopy_64.c x86/usercopy: Include arch_wb_cache_pmem() declaration 2023-05-18 11:56:18 -07:00
x86-opcode-map.txt x86/insn: Add support for APX EVEX instructions to the opcode map 2024-05-02 13:13:46 +02:00