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
Kconfig -rw-r--r-- 12.1 KB
Makefile -rw-r--r-- 1.6 KB
ath3k.c -rw-r--r-- 16.1 KB
bcm203x.c -rw-r--r-- 6.7 KB
bfusb.c -rw-r--r-- 15.6 KB
bluecard_cs.c -rw-r--r-- 19.8 KB
bpa10x.c -rw-r--r-- 9.5 KB
bt3c_cs.c -rw-r--r-- 14.7 KB
btbcm.c -rw-r--r-- 12.9 KB
btbcm.h -rw-r--r-- 2.6 KB
btintel.c -rw-r--r-- 17.0 KB
btintel.h -rw-r--r-- 4.9 KB
btmrvl_debugfs.c -rw-r--r-- 5.4 KB
btmrvl_drv.h -rw-r--r-- 5.0 KB
btmrvl_main.c -rw-r--r-- 17.9 KB
btmrvl_sdio.c -rw-r--r-- 40.4 KB
btmrvl_sdio.h -rw-r--r-- 3.3 KB
btmtkuart.c -rw-r--r-- 14.2 KB
btqca.c -rw-r--r-- 10.1 KB
btqca.h -rw-r--r-- 3.6 KB
btqcomsmd.c -rw-r--r-- 5.5 KB
btrsi.c -rw-r--r-- 4.6 KB
btrtl.c -rw-r--r-- 19.4 KB
btrtl.h -rw-r--r-- 2.6 KB
btsdio.c -rw-r--r-- 8.4 KB
btusb.c -rw-r--r-- 88.7 KB
btwilink.c -rw-r--r-- 8.5 KB
dtl1_cs.c -rw-r--r-- 12.4 KB
h4_recv.h -rw-r--r-- 3.5 KB
hci_ag6xx.c -rw-r--r-- 7.8 KB
hci_ath.c -rw-r--r-- 5.9 KB
hci_bcm.c -rw-r--r-- 33.0 KB
hci_bcsp.c -rw-r--r-- 18.7 KB
hci_h4.c -rw-r--r-- 6.0 KB
hci_h5.c -rw-r--r-- 23.0 KB
hci_intel.c -rw-r--r-- 30.3 KB
hci_ldisc.c -rw-r--r-- 20.0 KB
hci_ll.c -rw-r--r-- 19.6 KB
hci_mrvl.c -rw-r--r-- 8.6 KB
hci_nokia.c -rw-r--r-- 18.4 KB
hci_qca.c -rw-r--r-- 36.6 KB
hci_serdev.c -rw-r--r-- 8.4 KB
hci_uart.h -rw-r--r-- 5.2 KB
hci_vhci.c -rw-r--r-- 8.0 KB

back to top