summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/kasan.h
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2023-01-27 19:08:29 +0300
committerHeiko Carstens <hca@linux.ibm.com>2023-02-06 13:13:55 +0300
commit8382c963249dafcbe809dea307c2de16d5645579 (patch)
tree688302288abea53f10fdf777f7510a31b4d70ea2 /arch/s390/include/asm/kasan.h
parent3615d01114047ffce3a0942c21e6402c7b49bb3f (diff)
downloadlinux-8382c963249dafcbe809dea307c2de16d5645579.tar.xz
s390/boot: avoid page tables memory in kaslr
If kernel is build without KASAN support there is a chance that kernel image is going to be positioned by KASLR code to overlap with identity mapping page tables. When kernel is build with KASAN support enabled memory which is potentially going to be used for page tables and KASAN shadow mapping is accounted for in KASLR with the use of kasan_estimate_memory_needs(). Split this function and introduce vmem_estimate_memory_needs() to cover decompressor's vmem identity mapping page tables. Fixes: bb1520d581a3 ("s390/mm: start kernel with DAT enabled") Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/kasan.h')
-rw-r--r--arch/s390/include/asm/kasan.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/s390/include/asm/kasan.h b/arch/s390/include/asm/kasan.h
index f7244cc16240..e5cfc81d5b61 100644
--- a/arch/s390/include/asm/kasan.h
+++ b/arch/s390/include/asm/kasan.h
@@ -20,9 +20,9 @@ extern void kasan_early_init(void);
* at the very end of available physical memory. To estimate
* that, we take into account that kasan would require
* 1/8 of available physical memory (for shadow memory) +
- * creating page tables for the whole memory + shadow memory
- * region (1 + 1/8). To keep page tables estimates simple take
- * the double of combined ptes size.
+ * creating page tables for the shadow memory region.
+ * To keep page tables estimates simple take the double of
+ * combined ptes size.
*
* physmem parameter has to be already adjusted if not entire physical memory
* would be used (e.g. due to effect of "mem=" option).
@@ -34,7 +34,7 @@ static inline unsigned long kasan_estimate_memory_needs(unsigned long physmem)
/* for shadow memory */
kasan_needs = round_up(physmem / 8, PAGE_SIZE);
/* for paging structures */
- pages = DIV_ROUND_UP(physmem + kasan_needs, PAGE_SIZE);
+ pages = DIV_ROUND_UP(kasan_needs, PAGE_SIZE);
kasan_needs += DIV_ROUND_UP(pages, _PAGE_ENTRIES) * _PAGE_TABLE_SIZE * 2;
return kasan_needs;