Message ID | 20240621002616.40684-33-iii@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kmsan: Enable on s390 | expand |
On Fri, Jun 21, 2024 at 2:27 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote: > > Add KMSAN vmalloc metadata areas to kernel_page_tables. > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Alexander Potapenko <glider@google.com>
On Fri, 2024-06-21 at 02:25 +0200, Ilya Leoshkevich wrote: > Add KMSAN vmalloc metadata areas to kernel_page_tables. > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> > --- > arch/s390/mm/dump_pagetables.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/arch/s390/mm/dump_pagetables.c > b/arch/s390/mm/dump_pagetables.c > index ffd07ed7b4af..f51e5d0862a3 100644 > --- a/arch/s390/mm/dump_pagetables.c > +++ b/arch/s390/mm/dump_pagetables.c > @@ -36,6 +36,16 @@ enum address_markers_idx { > VMEMMAP_END_NR, > VMALLOC_NR, > VMALLOC_END_NR, > +#ifdef CONFIG_KMSAN > + KMSAN_VMALLOC_SHADOW_START_NR, > + KMSAN_VMALLOC_SHADOW_END_NR, > + KMSAN_VMALLOC_ORIGIN_START_NR, > + KMSAN_VMALLOC_ORIGIN_END_NR, > + KMSAN_MODULES_SHADOW_START_NR, > + KMSAN_MODULES_SHADOW_END_NR, > + KMSAN_MODULES_ORIGIN_START_NR, > + KMSAN_MODULES_ORIGIN_END_NR, > +#endif > MODULES_NR, > MODULES_END_NR, > ABS_LOWCORE_NR, > @@ -74,6 +84,16 @@ static struct addr_marker address_markers[] = { > #ifdef CONFIG_KASAN > [KASAN_SHADOW_START_NR] = {KASAN_SHADOW_START, > "Kasan Shadow Start"}, > [KASAN_SHADOW_END_NR] = {KASAN_SHADOW_END, "Kasan Shadow > End"}, > +#endif > +#ifdef CONFIG_KMSAN > + [KMSAN_VMALLOC_SHADOW_START_NR] = {0, "Kmsan vmalloc > Shadow Start"}, > + [KMSAN_VMALLOC_SHADOW_END_NR] = {0, "Kmsan vmalloc Shadow > End"}, > + [KMSAN_VMALLOC_ORIGIN_START_NR] = {0, "Kmsan vmalloc > Origins Start"}, > + [KMSAN_VMALLOC_ORIGIN_END_NR] = {0, "Kmsan vmalloc Origins > End"}, > + [KMSAN_MODULES_SHADOW_START_NR] = {0, "Kmsan Modules > Shadow Start"}, > + [KMSAN_MODULES_SHADOW_END_NR] = {0, "Kmsan Modules Shadow > End"}, > + [KMSAN_MODULES_ORIGIN_START_NR] = {0, "Kmsan Modules > Origins Start"}, > + [KMSAN_MODULES_ORIGIN_END_NR] = {0, "Kmsan Modules Origins > End"}, > #endif Please disregard this patch. It's not essential for the series, and also has a subtle bug: this block needs to be moved upwards, because right now { -1, NULL } overlaps [MODULES_NR]. I will resend it separately later. > { -1, NULL } > };
diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c index ffd07ed7b4af..f51e5d0862a3 100644 --- a/arch/s390/mm/dump_pagetables.c +++ b/arch/s390/mm/dump_pagetables.c @@ -36,6 +36,16 @@ enum address_markers_idx { VMEMMAP_END_NR, VMALLOC_NR, VMALLOC_END_NR, +#ifdef CONFIG_KMSAN + KMSAN_VMALLOC_SHADOW_START_NR, + KMSAN_VMALLOC_SHADOW_END_NR, + KMSAN_VMALLOC_ORIGIN_START_NR, + KMSAN_VMALLOC_ORIGIN_END_NR, + KMSAN_MODULES_SHADOW_START_NR, + KMSAN_MODULES_SHADOW_END_NR, + KMSAN_MODULES_ORIGIN_START_NR, + KMSAN_MODULES_ORIGIN_END_NR, +#endif MODULES_NR, MODULES_END_NR, ABS_LOWCORE_NR, @@ -74,6 +84,16 @@ static struct addr_marker address_markers[] = { #ifdef CONFIG_KASAN [KASAN_SHADOW_START_NR] = {KASAN_SHADOW_START, "Kasan Shadow Start"}, [KASAN_SHADOW_END_NR] = {KASAN_SHADOW_END, "Kasan Shadow End"}, +#endif +#ifdef CONFIG_KMSAN + [KMSAN_VMALLOC_SHADOW_START_NR] = {0, "Kmsan vmalloc Shadow Start"}, + [KMSAN_VMALLOC_SHADOW_END_NR] = {0, "Kmsan vmalloc Shadow End"}, + [KMSAN_VMALLOC_ORIGIN_START_NR] = {0, "Kmsan vmalloc Origins Start"}, + [KMSAN_VMALLOC_ORIGIN_END_NR] = {0, "Kmsan vmalloc Origins End"}, + [KMSAN_MODULES_SHADOW_START_NR] = {0, "Kmsan Modules Shadow Start"}, + [KMSAN_MODULES_SHADOW_END_NR] = {0, "Kmsan Modules Shadow End"}, + [KMSAN_MODULES_ORIGIN_START_NR] = {0, "Kmsan Modules Origins Start"}, + [KMSAN_MODULES_ORIGIN_END_NR] = {0, "Kmsan Modules Origins End"}, #endif { -1, NULL } }; @@ -306,6 +326,16 @@ static int pt_dump_init(void) #ifdef CONFIG_KFENCE address_markers[KFENCE_START_NR].start_address = kfence_start; address_markers[KFENCE_END_NR].start_address = kfence_start + KFENCE_POOL_SIZE; +#endif +#ifdef CONFIG_KMSAN + address_markers[KMSAN_VMALLOC_SHADOW_START_NR].start_address = KMSAN_VMALLOC_SHADOW_START; + address_markers[KMSAN_VMALLOC_SHADOW_END_NR].start_address = KMSAN_VMALLOC_SHADOW_END; + address_markers[KMSAN_VMALLOC_ORIGIN_START_NR].start_address = KMSAN_VMALLOC_ORIGIN_START; + address_markers[KMSAN_VMALLOC_ORIGIN_END_NR].start_address = KMSAN_VMALLOC_ORIGIN_END; + address_markers[KMSAN_MODULES_SHADOW_START_NR].start_address = KMSAN_MODULES_SHADOW_START; + address_markers[KMSAN_MODULES_SHADOW_END_NR].start_address = KMSAN_MODULES_SHADOW_END; + address_markers[KMSAN_MODULES_ORIGIN_START_NR].start_address = KMSAN_MODULES_ORIGIN_START; + address_markers[KMSAN_MODULES_ORIGIN_END_NR].start_address = KMSAN_MODULES_ORIGIN_END; #endif sort_address_markers(); #ifdef CONFIG_PTDUMP_DEBUGFS
Add KMSAN vmalloc metadata areas to kernel_page_tables. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- arch/s390/mm/dump_pagetables.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)