[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160429080754.GA3881@gmail.com>
Date: Fri, 29 Apr 2016 10:07:54 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Yinghai Lu <yinghai@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Baoquan He <bhe@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
Borislav Petkov <bp@...en8.de>,
Vivek Goyal <vgoyal@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Lasse Collin <lasse.collin@...aani.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Young <dyoung@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of
decompression buffer
* Kees Cook <keescook@...omium.org> wrote:
> I don't agree. We do still have embedded systems running x86 kernels, and we
> have cases where we're running multiple kernels in memory (like kdump). I think
> the memory savings is worth the complexity, especially since the complexity is
> being reduced up by this patch. [...]
Hm, so can we quantify it, how much are the temporary memory savings in practice?
I'd like to see actual vmlinuz numbers with say a defconfig and with a distro
config.
Small systems tend to have smaller kernel images, so the temporary savings tend to
be smaller as well. There's no long term loss, we'd still recover all memory not
used by the resulting kernel image and make it usable as free RAM. So the only
question is the temporary memory allocation size of the decompression step.
> [...] But that's not all:
>
> If we moved the compressed kernel after the buffer, the only thing
> we'd do would be taking up more memory. We'd still have the head_*.S
> complexity of handling the relocation and handling the copy, we'd
> still have the extraction, etc, etc. The only thing would be literally
> changing extract_offset to INIT_SIZE. Everything else would be the
> same.
Yes - but arguing about all this code would cause a lot fewer headaches,
for me at least!
Also, I think once we've simplified the whole model of decompression, we can
improve on the structure even more.
> If we moved the decompressed kernel after the compressed kernel, (ignoring KASLR
> for a moment) then we'd end up in a confusing situation where the kernel would
> be running somewhere other than where the boot loader asked it to load. I don't
> even want to think about the weird bug reports we might get from a change like
> that from old or weird loaders.
Well, 'where the boot loader asked it to load' in this case is essentially the
z_extract_offset .globl, isn't it? But how to use that value is a mostly x86
kernel internal matter - in fact there's even an inversion step between the 32-bit
and 64-bit value. Is there any other boot loader environment component I missed?
Thanks,
Ingo
Powered by blists - more mailing lists