android_kernel_oneplus_msm8998/arch/s390
Vasily Gorbik 399b4e062f s390/topology: avoid firing events before kobjs are created
commit f3122a79a1b0a113d3aea748e0ec26f2cb2889de upstream.

arch_update_cpu_topology is first called from:
kernel_init_freeable->sched_init_smp->sched_init_domains

even before cpus has been registered in:
kernel_init_freeable->do_one_initcall->s390_smp_init

Do not trigger kobject_uevent change events until cpu devices are
actually created. Fixes the following kasan findings:

BUG: KASAN: global-out-of-bounds in kobject_uevent_env+0xb40/0xee0
Read of size 8 at addr 0000000000000020 by task swapper/0/1

BUG: KASAN: global-out-of-bounds in kobject_uevent_env+0xb36/0xee0
Read of size 8 at addr 0000000000000018 by task swapper/0/1

CPU: 0 PID: 1 Comm: swapper/0 Tainted: G    B
Hardware name: IBM 3906 M04 704 (LPAR)
Call Trace:
([<0000000143c6db7e>] show_stack+0x14e/0x1a8)
 [<0000000145956498>] dump_stack+0x1d0/0x218
 [<000000014429fb4c>] print_address_description+0x64/0x380
 [<000000014429f630>] __kasan_report+0x138/0x168
 [<0000000145960b96>] kobject_uevent_env+0xb36/0xee0
 [<0000000143c7c47c>] arch_update_cpu_topology+0x104/0x108
 [<0000000143df9e22>] sched_init_domains+0x62/0xe8
 [<000000014644c94a>] sched_init_smp+0x3a/0xc0
 [<0000000146433a20>] kernel_init_freeable+0x558/0x958
 [<000000014599002a>] kernel_init+0x22/0x160
 [<00000001459a71d4>] ret_from_fork+0x28/0x30
 [<00000001459a71dc>] kernel_thread_starter+0x0/0x10

Cc: stable@vger.kernel.org
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-17 13:40:52 -07:00
..
appldata
boot s390/decompressor: fix initrd corruption caused by bss clear 2017-04-12 12:38:34 +02:00
configs
crypto s390/crypto: unlock on error in prng_tdes_read() 2017-01-12 11:22:49 +01:00
hypfs hypfs: Fix error number left in struct pointer member 2019-10-07 21:01:02 +02:00
include s390: fix stfle zero padding 2019-07-21 09:07:15 +02:00
kernel s390/topology: avoid firing events before kobjs are created 2019-10-17 13:40:52 -07:00
kvm KVM: s390: Test for bad access register and size at the start of S390_MEM_OP 2019-10-17 13:40:52 -07:00
lib s390/lib: use expoline for all bcr instructions 2018-09-15 09:40:42 +02:00
mm mm: replace get_user_pages_unlocked() write/force parameters with gup_flags 2018-12-17 21:55:16 +01:00
net s390/bpf: use 32-bit index for tail calls 2019-09-21 07:12:49 +02:00
numa s390/mm: Fix ERROR: "__node_distance" undefined! 2018-11-27 16:08:01 +01:00
oprofile
pci s390/pci: fix out of bounds access during irq setup 2018-09-05 09:18:40 +02:00
defconfig
Kbuild
Kconfig s390: add sysfs attributes for spectre 2018-04-29 07:50:04 +02:00
Kconfig.debug
Makefile s390: add automatic detection of the spectre defense 2018-04-29 07:50:04 +02:00