linux-stable/arch/arm64/mm
Andrey Konovalov 3f41b60938 kasan: fix random seed generation for tag-based mode
There are two issues with assigning random percpu seeds right now:

1. We use for_each_possible_cpu() to iterate over cpus, but cpumask is
   not set up yet at the moment of kasan_init(), and thus we only set
   the seed for cpu #0.

2. A call to get_random_u32() always returns the same number and produces
   a message in dmesg, since the random subsystem is not yet initialized.

Fix 1 by calling kasan_init_tags() after cpumask is set up.

Fix 2 by using get_cycles() instead of get_random_u32(). This gives us
lower quality random numbers, but it's good enough, as KASAN is meant to
be used as a debugging tool and not a mitigation.

Link: http://lkml.kernel.org/r/1f815cc914b61f3516ed4cc9bfd9eeca9bd5d9de.1550677973.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-02-21 09:01:00 -08:00
..
cache.S arm64: Fix minor issues with the dcache_by_line_op macro 2018-12-10 15:03:51 +00:00
context.c arm64: mm: Drop the unused cpu parameter 2018-10-09 17:17:23 +01:00
copypage.c arm64: Defer dcache flush in __cpu_copy_user_page 2015-12-17 11:07:13 +00:00
dma-mapping.c arm64/xen: fix xen-swiotlb cache flushing 2019-01-23 22:14:56 +01:00
dump.c arm64: ptdump: Don't iterate kernel page tables using PTRS_PER_PXX 2019-02-04 14:37:38 +00:00
extable.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fault.c kasan, arm64: fix up fault handling logic 2018-12-28 12:11:43 -08:00
flush.c arm64: Do not issue IPIs for user executable ptes 2019-02-01 14:06:50 +00:00
hugetlbpage.c arm64: hugetlb: Register hugepages during arch init 2018-12-06 17:01:13 +00:00
init.c arm64 fixes for -rc1 2019-01-05 11:28:39 -08:00
ioremap.c arm64: use is_vmalloc_addr 2017-02-09 13:47:56 +00:00
kasan_init.c kasan: fix random seed generation for tag-based mode 2019-02-21 09:01:00 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmap.c exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
mmu.c lib/ioremap: ensure break-before-make is used for huge p4d mappings 2018-12-28 12:11:50 -08:00
numa.c arm64: Add memory hotplug support 2018-12-12 14:43:43 +00:00
pageattr.c arm64: mm: apply r/o permissions of VM areas to its linear alias as well 2018-11-20 11:38:26 +00:00
pgd.c arm64: handle 52-bit addresses in TTBR 2017-12-22 17:35:21 +00:00
physaddr.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
proc.S kasan, arm64: enable top byte ignore for the kernel 2018-12-28 12:11:43 -08:00
ptdump_debugfs.c ARM64: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro 2018-07-02 10:36:37 +01:00