Re: [PATCH] x86/kdump: Fix 'kmem -s' reported an invalid freepointer when SME was active
From: Baoquan He
Date: Fri Sep 27 2019 - 20:05:17 EST
On 09/27/19 at 03:49pm, Eric W. Biederman wrote:
> Dave Young <dyoung@xxxxxxxxxx> writes:
> >> In order to avoid such problem, lets occupy the first 640k region when
> >> SME is active, which will ensure that the allocated memory does not fall
> >> into the first 640k area. So, no need to worry about whether kernel can
> >> correctly copy the contents of the first 640K area to a backup region in
> >> purgatory().
>
> We must occupy part of the first 640k so that we can start up secondary
> cpus unless someone has added another way to do that in recent years on
> SME capable cpus.
>
> Further there is Fimware/BIOS interaction that happens within those
> first 640K.
>
> Furthermore the kdump kernel needs to be able to read all of the memory
> that the previous kernel could read. Otherwise we can't get a crash
> dump.
>
> So I do not think ignoring the first 640K is the correct resolution
> here.
>
> > The log is too simple, I know you did some other tries to fix this, but
> > the patch log does not show why you can not correctly copy the 640k in
> > current kdump code, in purgatory here.
> >
> > Also this patch seems works in your test, but still to see if other
> > people can comment and see if it is safe or not, if any other risks
> > other than waste the small chunk of memory. If it is safe then kdump
> > can just drop the backup logic and use this in common code instead of
> > only do it for SME.
>
> Exactly.
>
> I think at best this avoids the symptoms, but does not give a reliable
> crash dump.
Sorry, didn't notice this comment at bottom.
>From code, currently the first 640K area is needed in two places.
One is for 5-level trampoline during boot compressing stage, in
find_trampoline_placement().
The other is in reserve_real_mode(), as you mentioned, for application
CPU booting.
Only allow these two put data inside first 640K, then lock it done. It
should not impact crash dump and parsing. And these two's content
doesn't matter.
Thanks
Baoquan