linux-stable/arch/x86
Mateusz Jurczyk fc152d22d6 x86/alternatives: Prevent uninitialized stack byte read in apply_alternatives()
In the current form of the code, if a->replacementlen is 0, the reference
to *insnbuf for comparison touches potentially garbage memory. While it
doesn't affect the execution flow due to the subsequent a->replacementlen
comparison, it is (rightly) detected as use of uninitialized memory by a
runtime instrumentation currently under my development, and could be
detected as such by other tools in the future, too (e.g. KMSAN).

Fix the "false-positive" by reordering the conditions to first check the
replacement instruction length before referencing specific opcode bytes.

Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Link: http://lkml.kernel.org/r/20170524135500.27223-1-mjurczyk@google.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-05-24 16:18:12 +02:00
..
boot x86/boot: Use CROSS_COMPILE prefix for readelf 2017-05-21 13:04:27 +02:00
configs Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-01 20:51:12 -07:00
crypto crypto: glue_helper - remove the le128_gf128mul_x_ble function 2017-04-05 21:58:37 +08:00
entry Revert "x86/entry: Fix the end of the stack for newly forked tasks" 2017-05-24 09:05:16 +02:00
events perf/core improvements and fixes: 2017-05-03 19:28:27 +02:00
hyperv char/misc patches for 4.12-rc1 2017-05-04 19:15:35 -07:00
ia32 sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
include KVM: x86: lower default for halt_poll_ns 2017-05-16 21:15:50 +02:00
kernel x86/alternatives: Prevent uninitialized stack byte read in apply_alternatives() 2017-05-24 16:18:12 +02:00
kvm KVM: x86: prevent uninitialized variable warning in check_svme() 2017-05-19 19:59:28 +02:00
lguest Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-05-01 20:51:12 -07:00
lib x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility 2017-05-05 08:31:05 +02:00
math-emu Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
mm x86/PAT: Fix Xorg regression on CPUs that don't support PAT 2017-05-24 10:17:23 +02:00
net x86: use set_memory.h header 2017-05-08 17:15:13 -07:00
oprofile
pci pci-v4.12-changes 2017-05-08 19:03:25 -07:00
platform x86: use set_memory.h header 2017-05-08 17:15:13 -07:00
power x86/mm: Add support for gbpages to kernel_ident_mapping_init() 2017-05-08 08:28:40 +02:00
purgatory kasan: do not sanitize kexec purgatory 2017-03-31 17:13:30 -07:00
ras RAS: Add a Corrected Errors Collector 2017-03-28 08:54:48 +02:00
realmode x86: use set_memory.h header 2017-05-08 17:15:13 -07:00
tools x86/tools: Fix gcc-7 warning in relocs.c 2016-12-19 11:50:24 +01:00
um Merge branch 'for-linus-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2017-05-13 10:20:02 -07:00
video
xen xen: make xen_flush_tlb_all() static 2017-05-19 08:04:25 +02:00
.gitignore
Kbuild Drivers: hv vmbus: Move Hypercall page setup out of common code 2017-01-19 11:42:07 +01:00
Kconfig x86/watchdog: Fix Kconfig help text file path reference to lockup watchdog documentation 2017-05-24 09:06:32 +02:00
Kconfig.cpu
Kconfig.debug usb/early: Add driver for xhci debug capability 2017-03-21 12:30:05 +01:00
Makefile x86/build: Permit building with old make versions 2017-05-24 09:05:17 +02:00
Makefile.um
Makefile_32.cpu x86/build: Mostly disable '-maccumulate-outgoing-args' 2017-03-30 11:53:04 +02:00