linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Yinghai Lu <yinghai@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Baoquan He <bhe@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Borislav Petkov <bp@alien8.de>, Vivek Goyal <vgoyal@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Lasse Collin <lasse.collin@tukaani.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Young <dyoung@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer
Date: Fri, 29 Apr 2016 10:07:54 +0200	[thread overview]
Message-ID: <20160429080754.GA3881@gmail.com> (raw)
In-Reply-To: <CAGXu5jLyeaUV_Pe7d-GoTdb+PxsTynkGAw+MzK3xd+_gCqbnvg@mail.gmail.com>


* 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

  reply	other threads:[~2016-04-29  8:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  0:09 [PATCH 0/6] x86/boot: Improve compressed kernel handling Kees Cook
2016-04-29  0:09 ` [PATCH 1/6] x86/KASLR: Handle kernel relocation above 2G Kees Cook
2016-04-29  8:02   ` [tip:x86/boot] x86/KASLR: Handle kernel relocations above 2G correctly tip-bot for Baoquan He
2016-04-29  0:09 ` [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Kees Cook
2016-04-29  7:18   ` Ingo Molnar
2016-04-29  7:48     ` Kees Cook
2016-04-29  8:07       ` Ingo Molnar [this message]
2016-04-29  9:51         ` Ingo Molnar
2016-04-29  9:51   ` [tip:x86/boot] x86/boot: Move compressed kernel to the end of the " tip-bot for Yinghai Lu
2016-08-16  4:01   ` [PATCH 2/6] x86/boot: Move compressed kernel to end of " Matt Mullins
2016-08-16 19:19     ` Yinghai Lu
2016-08-17  2:25       ` Matt Mullins
2016-10-03 21:50         ` Simon Glass
2016-11-30 16:52           ` Andy Shevchenko
2016-04-29  0:09 ` [PATCH 3/6] x86/boot: Calculate decompression size during boot not build Kees Cook
2016-04-29  9:52   ` [tip:x86/boot] " tip-bot for Yinghai Lu
2016-04-29  0:09 ` [PATCH 4/6] x86/boot: Fix "run_size" calculation Kees Cook
2016-04-29  9:52   ` [tip:x86/boot] " tip-bot for Yinghai Lu
2016-04-29  0:09 ` [PATCH 5/6] x86/KASLR: Clean up unused code from old "run_size" Kees Cook
2016-04-29  9:52   ` [tip:x86/boot] x86/KASLR: Clean up unused code from old 'run_size' and rename it to 'kernel_total_size' tip-bot for Yinghai Lu
2016-04-29  0:09 ` [PATCH 6/6] x86/boot: Correctly bounds-check relocations Kees Cook
2016-04-29  9:53   ` [tip:x86/boot] " tip-bot for Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160429080754.GA3881@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=lasse.collin@tukaani.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=vgoyal@redhat.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).