Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1983710ybv; Thu, 6 Feb 2020 13:34:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyA8IrP8lFun6ZNOSCXw/9FyQoTIinlmQmTMHEZx4tDoiArqIpf/65XC4y9XnwH5ApCg8Wi X-Received: by 2002:a9d:76d6:: with SMTP id p22mr119784otl.37.1581024862628; Thu, 06 Feb 2020 13:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581024862; cv=none; d=google.com; s=arc-20160816; b=ieU6pjbFiHgnZSXYF44Un2+uAulbkRYZOzNSmYtVI++cfz2eSaO57n60YA/en24hqY VhNxXe6k8xMKCa2mby32F0BDCmW/tcMC52CD8Vxeun1fn+9s49DxaMtTE7uHIiGwgFMO n2wkqE4X7WqN8Po9VvjbdPXHQgPXrxwGzctJ+hM1QWqZiGonio7kjLjguGK/Uw+NEhgd t31JEGnCkfEuc66PzppdGSh95UGxdQCNWH2N/FcZKh4v8nVegbcYkVhHLPMXwUiuB13d Nbh0O11c9v/NIBzCcodwLXvTqpSYpZOu2ed6RWCORrXqU0MELvhI4yL1/+I/9A7ctWvS IOcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CZIR0O4XSSHJzQ5NKMOaMQy9m9LNXwiQasS8KWy7Rew=; b=y9kOt38pXnzvY+dij/+H+ooRb6QEN5zTxfFmOVx8x22omAh2zBz7RR/VxDHDWWHjKG hVtOzh9FY8DCA8bnAQ5tgfzfayXz3gPFOt+SWvXA9Qn7l46Iwj3tA4wYyDK0lUJbMVdT g7fTNKJAUr07263BF+UoYfWYY4AcWU48uo5BiXtrrPotMSTTnbx+heiy1p8bBIDQyLFO WfVf/73t8+SuBgSOorfFNQ2QVih7OGmpMW3wkrrI88Y9GsLkB0IfJ8hxBw3OleXx3q6y ROkOYb2hsysfsW9xFBP08ddIVexwFuJhcKo988x0h0YqX7e0/K3xLhEkDwc6i4hB9lfW GTEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KVrwWF2S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si2939351oij.84.2020.02.06.13.34.04; Thu, 06 Feb 2020 13:34:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KVrwWF2S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbgBFVcw (ORCPT + 99 others); Thu, 6 Feb 2020 16:32:52 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:39957 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727441AbgBFVcv (ORCPT ); Thu, 6 Feb 2020 16:32:51 -0500 Received: by mail-oi1-f194.google.com with SMTP id a142so6164561oii.7 for ; Thu, 06 Feb 2020 13:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CZIR0O4XSSHJzQ5NKMOaMQy9m9LNXwiQasS8KWy7Rew=; b=KVrwWF2SKiVwKyoIsPVvbAikP44PdWvjeMhQkEtI1By6Zls5EW4B3PSNuMcCWXxG/v xusmhSnTOcGjtj7V7BFKf6KBGw/XRFI38EnRK/cpY6ftMFBmZV6TSFD8jSDg+m6fy/z9 kWyh4e+ldTYzBi4iEsjBLdfXYAQLpCU5u9Vdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CZIR0O4XSSHJzQ5NKMOaMQy9m9LNXwiQasS8KWy7Rew=; b=PEWeiontZV1l/LbbwCBZ4q5udxiT46TFP5o87baNEAr8UPzSryERpGSHimT8l5TUKi jG/OktsQLKfirvZ4MoGg0s9qdu9S3umv2rICn80166AqtiRAMQia4WXcP3E9pYM9fivJ 8PZ24/Zm9bHw1irFAf6laRLPjdSLuVyN7bqDKsmmrR9henSzksv9I9Xz475F6NqWiHef G/4LO2jcfUl41PPWAOxzTR2kABpPYqkpgIYusZt5KrGTzekEa/5vJsIeMVMApIGSrl9U 5/DOhHpmYuKgfdIoUuZBe6Xv9FFTFGiq8BQ2Wz0e0KpURlYlCbnsxX1cM1J//OgZIWKj OfOA== X-Gm-Message-State: APjAAAU1nV3Oj+Y4gtVpMDbm5kiK81Qyv+YUVU5tx685d7opgYYYQQsB P1EHQDJbnagxHAjCZRzA6b69eQ== X-Received: by 2002:aca:cd46:: with SMTP id d67mr81999oig.156.1581024771067; Thu, 06 Feb 2020 13:32:51 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o1sm286736otl.49.2020.02.06.13.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 13:32:50 -0800 (PST) Date: Thu, 6 Feb 2020 13:32:48 -0800 From: Kees Cook To: Arvind Sankar Cc: Kristen Carlson Accardi , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, arjan@linux.intel.com, rick.p.edgecombe@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [RFC PATCH 11/11] x86/boot: Move "boot heap" out of .bss Message-ID: <202002061331.E5956EA@keescook> References: <20200205223950.1212394-1-kristen@linux.intel.com> <20200205223950.1212394-12-kristen@linux.intel.com> <20200206001103.GA220377@rani.riverdale.lan> <202002060251.681292DE63@keescook> <20200206142557.GA3033443@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200206142557.GA3033443@rani.riverdale.lan> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 09:25:59AM -0500, Arvind Sankar wrote: > On Thu, Feb 06, 2020 at 03:13:12AM -0800, Kees Cook wrote: > > Yes, thank you for the reminder. I couldn't find the ZO_INIT_SIZE when I > > was staring at this, since I only looked around the compressed/ directory. > > :) > > > > There's another thing I noticed -- you would need to ensure that the > init_size in the header covers your boot heap even if you did split it > out. The reason is that the bootloader will only know to reserve enough > memory for init_size: it's possible it might put the initrd or something > else following the kernel, or theoretically there might be reserved > memory regions or the end of physical RAM immediately following, so you > can't assume that area will be available when you get to extract_kernel. Yeah, that's what I was worrying about after I wrote that patch. Yours is the correct solution. :) (I Acked both of those now). -- Kees Cook