https://github.com/torvalds/linux
Revision 2a418cf3f5f1caf911af288e978d61c9844b0695 authored by Andy Lutomirski on 23 February 2019, 01:17:04 UTC, committed by Borislav Petkov on 25 February 2019, 19:17:05 UTC
When calling __put_user(foo(), ptr), the __put_user() macro would call
foo() in between __uaccess_begin() and __uaccess_end().  If that code
were buggy, then those bugs would be run without SMAP protection.

Fortunately, there seem to be few instances of the problem in the
kernel. Nevertheless, __put_user() should be fixed to avoid doing this.
Therefore, evaluate __put_user()'s argument before setting AC.

This issue was noticed when an objtool hack by Peter Zijlstra complained
about genregs_get() and I compared the assembly output to the C source.

 [ bp: Massage commit message and fixed up whitespace. ]

Fixes: 11f1a4b9755f ("x86: reorganize SMAP handling in user space accesses")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20190225125231.845656645@infradead.org
1 parent f331e76
History
Tip revision: 2a418cf3f5f1caf911af288e978d61c9844b0695 authored by Andy Lutomirski on 23 February 2019, 01:17:04 UTC
x86/uaccess: Don't leak the AC flag into __put_user() value evaluation
Tip revision: 2a418cf
File Mode Size
governors
Kconfig -rw-r--r-- 1.0 KB
Kconfig.arm -rw-r--r-- 2.4 KB
Kconfig.mips -rw-r--r-- 618 bytes
Kconfig.powerpc -rw-r--r-- 480 bytes
Makefile -rw-r--r-- 1.3 KB
coupled.c -rw-r--r-- 25.6 KB
cpuidle-arm.c -rw-r--r-- 3.9 KB
cpuidle-at91.c -rw-r--r-- 1.6 KB
cpuidle-big_little.c -rw-r--r-- 6.7 KB
cpuidle-calxeda.c -rw-r--r-- 2.2 KB
cpuidle-clps711x.c -rw-r--r-- 1.5 KB
cpuidle-cps.c -rw-r--r-- 4.4 KB
cpuidle-exynos.c -rw-r--r-- 3.4 KB
cpuidle-kirkwood.c -rw-r--r-- 2.3 KB
cpuidle-mvebu-v7.c -rw-r--r-- 3.3 KB
cpuidle-powernv.c -rw-r--r-- 10.6 KB
cpuidle-pseries.c -rw-r--r-- 6.7 KB
cpuidle-ux500.c -rw-r--r-- 3.2 KB
cpuidle-zynq.c -rw-r--r-- 2.0 KB
cpuidle.c -rw-r--r-- 17.0 KB
cpuidle.h -rw-r--r-- 2.1 KB
driver.c -rw-r--r-- 8.7 KB
dt_idle_states.c -rw-r--r-- 6.5 KB
dt_idle_states.h -rw-r--r-- 216 bytes
governor.c -rw-r--r-- 2.6 KB
poll_state.c -rw-r--r-- 1.4 KB
sysfs.c -rw-r--r-- 18.3 KB

back to top