WSL2-Linux-Kernel/arch/x86/lib
Numfor Mbiziwo-Tiapo 5ba1071f75 x86/insn, tools/x86: Fix undefined behavior due to potential unaligned accesses
Don't perform unaligned loads in __get_next() and __peek_nbyte_next() as
these are forms of undefined behavior:

"A pointer to an object or incomplete type may be converted to a pointer
to a different object or incomplete type. If the resulting pointer
is not correctly aligned for the pointed-to type, the behavior is
undefined."

(from http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)

These problems were identified using the undefined behavior sanitizer
(ubsan) with the tools version of the code and perf test.

 [ bp: Massage commit message. ]

Signed-off-by: Numfor Mbiziwo-Tiapo <nums@google.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lkml.kernel.org/r/20210923161843.751834-1-irogers@google.com
2021-09-24 12:37:38 +02:00
..
.gitignore
Makefile x86: Add support for 0x22/0x23 port I/O configuration space 2021-08-10 23:31:43 +02:00
atomic64_32.c
atomic64_386_32.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
atomic64_cx8_32.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
cache-smp.c
checksum_32.S
clear_page_64.S
cmdline.c
cmpxchg8b_emu.S
cmpxchg16b_emu.S
copy_mc.c
copy_mc_64.S
copy_page_64.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
copy_user_64.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
cpu.c
csum-copy_64.S
csum-partial_64.c
csum-wrappers_64.c
delay.c
error-inject.c
getuser.S
hweight.S
inat.c x86/insn: Add a __ignore_sync_check__ marker 2021-03-15 11:00:57 +01:00
insn-eval.c x86/insn: Extend error reporting from insn_fetch_from_user[_inatomic]() 2021-06-15 11:39:30 +02:00
insn.c x86/insn, tools/x86: Fix undefined behavior due to potential unaligned accesses 2021-09-24 12:37:38 +02:00
iomap_copy_64.S
iomem.c
kaslr.c
memcpy_32.c
memcpy_64.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
memmove_64.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
memset_64.S x86/alternative: Merge include files 2021-03-11 15:58:02 +01:00
misc.c
mmx_32.c x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
msr-reg-export.c
msr-reg.S
msr-smp.c x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes 2021-03-22 21:37:03 +01:00
msr.c x86/msr: Make locally used functions static 2021-04-08 11:57:40 +02:00
pc-conf-reg.c x86: Add support for 0x22/0x23 port I/O configuration space 2021-08-10 23:31:43 +02:00
putuser.S
retpoline.S objtool/x86: Ignore __x86_indirect_alt_* symbols 2021-06-21 17:26:57 +02:00
string_32.c
strstr_32.c
usercopy.c
usercopy_32.c
usercopy_64.c
x86-opcode-map.txt