Received: by 10.223.185.116 with SMTP id b49csp5823493wrg; Tue, 27 Feb 2018 22:25:27 -0800 (PST) X-Google-Smtp-Source: AH8x226IdEsyMBg4cJbmaxM+3wtYmQjTaYIK/hRABIq32ekKmGJN1aKU7ZgX+FMPcOufQrMpBj3s X-Received: by 10.99.125.78 with SMTP id m14mr13384123pgn.391.1519799127595; Tue, 27 Feb 2018 22:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519799127; cv=none; d=google.com; s=arc-20160816; b=i9j6OgNInis0/i8rIonNRr9SaXe/8vCxYgbtm90j4GJ0VcXBSgLDzVuup34MQxy+PP d200ofbZjNmTBB09pzIdf/B1axsdr1zqEw/d39yf4hKjjUPc1lKwDIiprpc6xA64cWG/ KkEp5Xg83yFHXTTiGkrngpO4UyuBzLmRoSxqXuHmv2O3TqV7uIz4eOoTeCassKm8wlRo OIj1fA74FT9D+WmKnfl5bMge20gGPA/pq1mDqBS96rvRv1uX7jLtBifTzheuw/Gm2azb ZU5UNZ/jT30+fu2M4io10oNz26vAzB8rNdcpAdM7FE17Oq88nhwIROuSG+QB1QFKhivO M3+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=Rh9kvMvzfUNZjsbEC4iR01DhxqEXJXalSTinIBjDMRg=; b=J8OkL3DTV0gkU7VBTYdR5kFtEIOgUl7b++eRQUOYVWpxX6Il9gkbkyrBrnyjnitBFB kRTUeuW86A4SM9HyvXw2gBjbw1JSZsb09lDk6WQIiuHqGYULpYavEwbyCcmSx3Nu5Vcg sYY+jaoRgWKnz4QYyOGSnxSver5rjIJpMDbMsieEkO0a4Av9MXdmbwZ1GhJfAV1FVP5X cxFldticn5BAUC/lMVE5UWTBllFzG/jci+jISeoq0ezLGsEmfQr/OkS++EX6nrVCNES2 ODMJz3m4VbRbUKprZ1wKtOm4pq5ReJxUqYbNEJ1mMfookRp3655hkNrC/pA1sH+SZx9u X4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HpEFi+1Q; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si783459pll.354.2018.02.27.22.25.12; Tue, 27 Feb 2018 22:25:27 -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=@linaro.org header.s=google header.b=HpEFi+1Q; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbeB1GYL (ORCPT + 99 others); Wed, 28 Feb 2018 01:24:11 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:34178 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbeB1GYJ (ORCPT ); Wed, 28 Feb 2018 01:24:09 -0500 Received: by mail-io0-f195.google.com with SMTP id e7so2003975ioj.1 for ; Tue, 27 Feb 2018 22:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Rh9kvMvzfUNZjsbEC4iR01DhxqEXJXalSTinIBjDMRg=; b=HpEFi+1Q1W4YFxWsaF44XfAXTQyV089iHlkhlvyCQIqfj1p3GpFPvxy9ZzmiIETrjm QaE8ZWjYeQoyjG6vyi3Ek+Owwf7IZ4vwgA6RpV/PXFrHLxc6zh7HCXxJ2lkEB8bgcXto eHhKXhYkRZz4SuDAExdr7f9lJ98qIbceV+hOA= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=Rh9kvMvzfUNZjsbEC4iR01DhxqEXJXalSTinIBjDMRg=; b=aozjpr/XLVJEhvLaj/pDa84zBV8Z7bdY6ygKxWcvZpJfx54SVPoNH+afXHw/tZMkjw 2zHbPpEjxd6wwhVzEyvGqMmL9u4dzWpFQ1ZYxa2O0hpYof8qQjYpP7DLbt5JyU7wiZ7r 5z970GWnuZ7C9esXy50AMzfDbyxm54+KfB/n3aoJHwhxuDwEItmxlABVdLvk9x461Vj0 JHVYoTTO+LWPa2jNzmTr/OEilFGVcd2cmwlMx7otD7zWHiLOXDVwcz3K33rawGOHVvf2 RE4C+64qWRNpHdoOro08hnmd6nVCPo/C01VES5UwQne6igsi9F9DISsbJF0vQBY3CF3I oGiA== X-Gm-Message-State: APf1xPBAt50PMKimgAl6M36nZ+r0SiPTRuohRdn41Rr/6VG6C8UTn+z1 wrNEEA/5cJeWoMHyYVkR883QIQ== X-Received: by 10.107.51.78 with SMTP id z75mr20303904ioz.291.1519799048969; Tue, 27 Feb 2018 22:24:08 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id t4sm893769ita.24.2018.02.27.22.24.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 22:24:08 -0800 (PST) Date: Wed, 28 Feb 2018 15:19:03 +0900 From: AKASHI Takahiro To: Tyler Baicar Cc: ard.biesheuvel@linaro.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, jhugo@codeaurora.org, sgoel@codeaurora.org, timur@codeaurora.org Subject: Re: [PATCH 0/2] ESRT fixes for relocatable kexec'd kernel Message-ID: <20180228061901.GJ6019@linaro.org> Mail-Followup-To: AKASHI Takahiro , Tyler Baicar , ard.biesheuvel@linaro.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, jhugo@codeaurora.org, sgoel@codeaurora.org, timur@codeaurora.org References: <1519414953-5478-1-git-send-email-tbaicar@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519414953-5478-1-git-send-email-tbaicar@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tyler, # I missed catching your patch as its subject doesn't contain arm64. On Fri, Feb 23, 2018 at 12:42:31PM -0700, Tyler Baicar wrote: > Currently on arm64 ESRT memory does not appear to be properly blocked off. > Upon successful initialization, ESRT prints out the memory region that it > exists in like: > > esrt: Reserving ESRT space from 0x000000000a4c1c18 to 0x000000000a4c1cf0. > > But then by dumping /proc/iomem this region appears as part of System RAM > rather than being reserved: > > 08f10000-0deeffff : System RAM > > This causes issues when trying to kexec if the kernel is relocatable. When > kexec tries to execute, this memory can be selected to relocate the kernel to > which then overwrites all the ESRT information. Then when the kexec'd kernel > tries to initialize ESRT, it doesn't recognize the ESRT version number and > just returns from efi_esrt_init(). I'm not sure what is the root cause of your problem. Do you have good confidence that the kernel (2nd kernel image in this case?) really overwrite ESRT region? To my best knowledge, kexec is carefully designed not to do such a thing as it allocates a temporary buffer for kernel image and copies it to the final destination at the very end of the 1st kernel. My guess is that kexec, or rather kexec-tools, tries to load the kernel image at 0x8f80000 (or 0x9080000?, not sure) in your case. It may or may not be overlapped with ESRT. (Try "-d" option when executing kexec command for confirmation.) Are you using initrd with kexec? Thanks, -Takahiro AKASHI > This causes an early ioremap leak because > the memory allocated for 'va' is never unmapped. So first fix that error > case to properly unmap 'va' before returning. > > This still leaves ESRT unable to initialize in the kexec'd kernel, so now > mark the ESRT memory block as nomap so that this memory is not treated as > System RAM. With this change I'm able to see that the ESRT data is not > overwritten when running a kexec'd kernel. > > Tyler Baicar (2): > efi/esrt: fix unsupported version initialization failure > efi/esrt: mark ESRT memory region as nomap > > drivers/firmware/efi/esrt.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > -- > Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. > Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project. >