Re: Bad virt_to_phys since commit 54c7a8916a887f35

From: Mark Rutland
Date: Thu May 16 2019 - 10:30:04 EST


On Thu, May 16, 2019 at 03:20:59PM +0100, Steven Price wrote:
> On 16/05/2019 15:16, Mark Rutland wrote:
> > On Thu, May 16, 2019 at 03:05:31PM +0100, Steven Price wrote:
> >> I suspect the following is sufficient to fix the problem:
> >>
> >> ----8<-----
> >> diff --git a/init/initramfs.c b/init/initramfs.c
> >> index 435a428c2af1..178130fd61c2 100644
> >> --- a/init/initramfs.c
> >> +++ b/init/initramfs.c
> >> @@ -669,7 +669,7 @@ static int __init populate_rootfs(void)
> >> * If the initrd region is overlapped with crashkernel reserved region,
> >> * free only memory that is not part of crashkernel region.
> >> */
> >> - if (!do_retain_initrd && !kexec_free_initrd())
> >> + if (!do_retain_initrd && initrd_start && !kexec_free_initrd())
> >> free_initrd_mem(initrd_start, initrd_end);
> >> initrd_start = 0;
> >> initrd_end = 0;
> >
> > That works for me. If you spin this as a real patch:
> >
> > Tested-by: Mark Rutland <mark.rutland@xxxxxxx>
> >
> > As I mentioned, initrd_start has not been initialized at all, so I
> > suspect we should also update its declaration in init/do_mounts_initrd.c
> > such that it is guaranteed to be initialized to zero. We get away with
> > that today, but that won't necessarily hold with LTO and so on...
>
> Well it's a global variable, so the C standard says it should be
> initialised to 0...

For some reason I was under the impression that wasn't guaranteed, but I
see that it is. Sorry for the noise.

> I'll spin a real patch and add your Tested-by

Great; thanks!

Mark.