Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4554946imj; Tue, 12 Feb 2019 19:13:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IaYQsS0FE9p6+B2XD1QEKmno4k4JAXT/RUVKiWmYyv3q8wTrrNXrbaOENCUZCvnk41ObjbZ X-Received: by 2002:a62:f5d7:: with SMTP id b84mr7374586pfm.36.1550027608550; Tue, 12 Feb 2019 19:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550027608; cv=none; d=google.com; s=arc-20160816; b=pfxlcAOihLiVh5mMwrIoxmtt2wvzfLwv9tSuWaegAOoWAN1AtTnoIk1A62cJezOoTe uO6vT4rWf2SXvO5l6qpPqVk+/Q4udRHlpDqNLr9vKffa4MdvCihxtNxqaz1sDvg7u9Mx D59OsUe5+1E8fUmY4ksTd12sxIAQ62GIJjrN8FouIwLQT3xwL2TdoipGDt5VBAjUNBxK qmvTZvboLeykEeERbiGeZU9StQBx2Zte/6NVYZe4j6uNFqAxfBB74VTPK0tcphQgLkVe zEgd55zW9iPiUp/B6hO1RlWqvt8O+XK6y0n0/hgZKegK/AADrdUeQB8H2ysXHCZTZkUb CRpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=m7Agtf9sPKkc9zS/sJzhx1d3mReZ6RbwB4hL9MJJttY=; b=St08mAZy7Q0EPFtiEPzWlLjvB3F0QjVKYUIaMlv+aM4Lux7VBzvu3ygNlIBdP6SR7K ZKg3NrQAyIknmeHbR/bXVhrfiVq291rJZPeO4IgPbeND58MGfKxMGsxeNQN4WeEyfesk k0aERE1bJP8evTSbsybpYhhAikAFX8S+5kT4/oCGXyDtFPl/IY1sR8BDA4JchfUdAjSp 4ahVzb30VZTHZ0TLqtfXTXm1en6+VL/gBl1yRPHpJtGab4B9xMirECqZxXFDy7BoC4fG D2GeIafA67aqabhCWn21X0YyD42bW1FBLwvfHA7KKD/ZzTt0qiylKAivmWFDvyZ7VFRG 5Jvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si15501655pla.405.2019.02.12.19.13.12; Tue, 12 Feb 2019 19:13:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731898AbfBMDNE (ORCPT + 99 others); Tue, 12 Feb 2019 22:13:04 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:6449 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728098AbfBMDNE (ORCPT ); Tue, 12 Feb 2019 22:13:04 -0500 X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="54212734" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 Feb 2019 11:13:02 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 4C4984C4BCDC; Wed, 13 Feb 2019 11:13:03 +0800 (CST) Received: from [10.167.226.60] (10.167.226.60) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Feb 2019 11:13:05 +0800 Subject: Re: [PATCH] x86/boot: minor improvement in kaslr To: Kees Cook CC: LKML , X86 ML , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Baoquan He , Chao Fan References: <20190201054853.28541-1-caoj.fnst@cn.fujitsu.com> From: Cao jin Message-ID: Date: Wed, 13 Feb 2019 11:10:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.60] X-yoursite-MailScanner-ID: 4C4984C4BCDC.A8EF6 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: caoj.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/19 4:20 PM, Kees Cook wrote: > On Fri, Feb 1, 2019 at 6:51 PM Cao jin wrote: >> >> comments fix: input_size is ZO image size which just don't count .bss >> in, but has .text, .data, etc; >> drop unecessary alignment: minimum is either 512M or output, both are >> CONFIG_PHYSICAL_ALIGN aligned(output is aligned in head_32/64.S). But >> mention it in earlier comments. >> >> Signed-off-by: Cao jin >> --- >> arch/x86/boot/compressed/kaslr.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c >> index 9ed9709d9947..a947c5aba34e 100644 >> --- a/arch/x86/boot/compressed/kaslr.c >> +++ b/arch/x86/boot/compressed/kaslr.c >> @@ -360,7 +360,7 @@ static void handle_mem_options(void) >> * (i.e. it does not include its run size). This range must be avoided >> * because it contains the data used for decompression. >> * >> - * [input+input_size, output+init_size) is [_text, _end) for ZO. This >> + * [input+input_size, output+init_size) is [_bss, _end) for ZO. This > > This isn't right. The comment was correct before. See > arch/x86/boot/compressed/vmlinux.lds.S for the layout of the ZO image: > after the compressed image is _text, _rodata, _got, _data, _bss, > _pgtable, and _end. "[_text, _end)" correctly identifies the span > used. > Finally see why I am wrong here, I mixed up with the input_size & ZO image file size. Sorry for the noise, and thanks very much for your hint, Kees! -- Sincerely, Cao jin