Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1390851

Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer
Date 2016-04-29 10:10 +0200
Message-ID <rtbES-2B9-11@gated-at.bofh.it> (permalink)
References <rt4am-4LZ-9@gated-at.bofh.it> <rt4k2-4Rw-7@gated-at.bofh.it> <rtaSu-1U4-15@gated-at.bofh.it> <rtblv-28S-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Kees Cook <keescook@chromium.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] x86/boot: Improve compressed kernel handling Kees Cook <keescook@chromium.org> - 2016-04-29 02:20 +0200
  [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Kees Cook <keescook@chromium.org> - 2016-04-29 02:20 +0200
    Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of  decompression buffer Ingo Molnar <mingo@kernel.org> - 2016-04-29 09:20 +0200
      Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of  decompression buffer Kees Cook <keescook@chromium.org> - 2016-04-29 09:50 +0200
        Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of  decompression buffer Ingo Molnar <mingo@kernel.org> - 2016-04-29 10:10 +0200
          Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of  decompression buffer Ingo Molnar <mingo@kernel.org> - 2016-04-29 12:00 +0200
    [tip:x86/boot] x86/boot: Move compressed kernel to the end of the  decompression buffer tip-bot for Yinghai Lu <tipbot@zytor.com> - 2016-04-29 12:00 +0200
  [PATCH 4/6] x86/boot: Fix "run_size" calculation Kees Cook <keescook@chromium.org> - 2016-04-29 02:20 +0200
    [tip:x86/boot] x86/boot: Fix "run_size" calculation tip-bot for Yinghai Lu <tipbot@zytor.com> - 2016-04-29 12:00 +0200

csiph-web