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
unittest-data
Kconfig -rw-r--r-- 2.3 KB
Makefile -rw-r--r-- 659 bytes
address.c -rw-r--r-- 24.1 KB
base.c -rw-r--r-- 58.7 KB
device.c -rw-r--r-- 8.2 KB
dynamic.c -rw-r--r-- 22.7 KB
fdt.c -rw-r--r-- 32.1 KB
fdt_address.c -rw-r--r-- 6.2 KB
irq.c -rw-r--r-- 18.6 KB
kobj.c -rw-r--r-- 3.8 KB
of_mdio.c -rw-r--r-- 13.8 KB
of_net.c -rw-r--r-- 2.4 KB
of_numa.c -rw-r--r-- 3.9 KB
of_private.h -rw-r--r-- 5.4 KB
of_reserved_mem.c -rw-r--r-- 10.3 KB
overlay.c -rw-r--r-- 34.3 KB
pdt.c -rw-r--r-- 4.9 KB
platform.c -rw-r--r-- 19.8 KB
property.c -rw-r--r-- 28.6 KB
resolver.c -rw-r--r-- 8.5 KB
unittest.c -rw-r--r-- 68.5 KB

back to top