[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b7a841d-bbbd-6018-556f-d2414a5f02b2@gmail.com>
Date: Mon, 14 Nov 2022 17:44:00 +0300
From: Andrey Ryabinin <ryabinin.a.a@...il.com>
To: Sean Christopherson <seanjc@...gle.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org
Cc: "H. Peter Anvin" <hpa@...or.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
syzbot+ffb4f000dc2872c93f62@...kaller.appspotmail.com,
syzbot+8cdd16fd5a6c0565e227@...kaller.appspotmail.com
Subject: Re: [PATCH v2 5/5] x86/kasan: Populate shadow for shared chunk of the
CPU entry area
On 11/10/22 23:35, Sean Christopherson wrote:
>
> + /*
> + * Populate the shadow for the shared portion of the CPU entry area.
> + * Shadows for the per-CPU areas are mapped on-demand, as each CPU's
> + * area is randomly placed somewhere in the 512GiB range and mapping
> + * the entire 512GiB range is prohibitively expensive.
> + */
> + kasan_populate_early_shadow((void *)shadow_cea_begin,
> + (void *)shadow_cea_per_cpu_begin);
> +
I know I suggested to use "early" here, but I just realized that this might be a problem.
This will actually map shadow page for the 8 pages (KASAN_SHADOW_SCALE_SHIFT) of the original memory.
In case there is some per-cpu entry area starting right at CPU_ENTRY_AREA_PER_CPU the shadow for it will
be covered with kasan_early_shadow_page instead of the usual one.
So we need to go back to your v1 PATCH, or alternatively we can round up CPU_ENTRY_AREA_PER_CPU
#define CPU_ENTRY_AREA_PER_CPU (CPU_ENTRY_AREA_RO_IDT + PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
Such change will also require fixing up max_cea calculation in init_cea_offsets()
Going back kasan_populate_shadow() seems like safer and easier choice. The only disadvantage of it
that we might waste 1 page, which is not much compared to the KASAN memory overhead.
> kasan_populate_early_shadow((void *)shadow_cea_end,
> kasan_mem_to_shadow((void *)__START_KERNEL_map));
>
Powered by blists - more mailing lists