Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752861AbcD2IIK (ORCPT ); Fri, 29 Apr 2016 04:08:10 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36216 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbcD2IH7 (ORCPT ); Fri, 29 Apr 2016 04:07:59 -0400 Date: Fri, 29 Apr 2016 10:07:54 +0200 From: Ingo Molnar To: Kees Cook Cc: Yinghai Lu , Ingo Molnar , Baoquan He , "H. Peter Anvin" , Borislav Petkov , Vivek Goyal , Andy Lutomirski , Lasse Collin , Andrew Morton , Dave Young , LKML Subject: Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Message-ID: <20160429080754.GA3881@gmail.com> References: <1461888548-32439-1-git-send-email-keescook@chromium.org> <1461888548-32439-3-git-send-email-keescook@chromium.org> <20160429071805.GC28320@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2126 Lines: 46 * Kees Cook 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