Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935434Ab3DPCel (ORCPT ); Mon, 15 Apr 2013 22:34:41 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34764 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935111Ab3DPCek (ORCPT ); Mon, 15 Apr 2013 22:34:40 -0400 Message-ID: <516CB8A8.2080007@zytor.com> Date: Mon, 15 Apr 2013 19:34:16 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Yinghai Lu CC: Kees Cook , Eric Northup , Linux Kernel Mailing List , "kernel-hardening@lists.openwall.com" , Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , Jarkko Sakkinen , Matthew Garrett , Matt Fleming , Dan Rosenberg , Julien Tinnes , Will Drewry Subject: Re: [PATCH 6/6] x86: kaslr: relocate base offset at boot References: <1365797627-20874-1-git-send-email-keescook@chromium.org> <1365797627-20874-7-git-send-email-keescook@chromium.org> <516A1D49.1050100@zytor.com> <516C702C.2030209@zytor.com> <516C751B.4020505@zytor.com> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 47 On 04/15/2013 03:38 PM, Yinghai Lu wrote: > On Mon, Apr 15, 2013 at 3:07 PM, Kees Cook wrote: >> On Mon, Apr 15, 2013 at 3:00 PM, Yinghai Lu wrote: >>> also do not overlap with boot_param, command_line, and initrd. >>> >>> and need to double check setup_header.init_size to make sure bss and >>> etc will not >>> fall into memory hole or reserved area in e820. >>> >>> also may need to setup page table for target position as bootloader may only >>> has ident mapping only for loaded bzImage 64 areas. >>> >>> looks you are trying redo the work for bootloader to pick loaded phys addr. >> >> aslr.S's select_aslr_address uses z_extract_offset as the upper bound. That seems really, really odd. > so the decompressed image is not moved high? This really seems wrong in so many ways. If you relocate pre-decompression the amount of memory you need is given by init_size: #define ZO_INIT_SIZE (ZO__end - ZO_startup_32 + ZO_z_extract_offset) #define VO_INIT_SIZE (VO__end - VO__text) #if ZO_INIT_SIZE > VO_INIT_SIZE #define INIT_SIZE ZO_INIT_SIZE #else #define INIT_SIZE VO_INIT_SIZE #endif init_size: .long INIT_SIZE # kernel initialization size In real life, VO_INIT_SIZE dominates almost every time. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/