Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5610601yba; Thu, 11 Apr 2019 01:43:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRbSzLyj6CXaLIrtrNHWTTsjOLAx2EbTC7mRjOnVxTbNpIBe6WyoqQIsp0VqOEeDl1AFqk X-Received: by 2002:a17:902:7883:: with SMTP id q3mr49115055pll.60.1554972227020; Thu, 11 Apr 2019 01:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554972227; cv=none; d=google.com; s=arc-20160816; b=Pz8Fs5pTOF/AaEPOO4zPEKfiSlgcNPPo23oRWvU3/dzBZpipJREG55+XnDjJ495TbI LdjC4s/MFz1tdgQ/D2CFarMpL2gu1c2fEf7Uzwh2rnOPexm+6QnWXT6Z8rVzkB0KzoV7 bazNujAb0SfP9kEHPuOLpTNse+vzKBzhJqej4rOY6PPrNnz20d+tQY9D9tIq4nLc87Yu t2hjUN3DZUd4kSNY2D4bxW4IPNgF5aLkUTFHuBe4wTv14KnScEnFW3IhG4YZFQyp5pvi Ogx0/mONdinPoUgUcCaKU8hgMJx5232Q1tgC5zdwt2RbKc3yDG9/ww7yfH4ZpFE/Xz3I GCIg== 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:message-id:subject:cc :to:from:date; bh=GvN9o0wfCh+Wo8K+p2irwj1/xtJ589tAInRixHwN3fs=; b=LYb7ZbGjx5MKqozB3+faMYWve2AuYaOl2fW+XuD2szrdin/YdzIBKzjqw1S1oYy0uI Nq5aFAtj51nV6zfOXL6opjdC+hNjbv6gSr1i2yI0XMoUqt6HKJ7b2fvh8+oG+FffsZOe zEK7EeIz2bB22JGhgT+YPWo/MD1G0zivK4Rka75Ek2iEDxPMu1F9/j29Pb+Z1NX1iqXa Thm3+JZhMz9DrI1w3F6reRQRu7ENMOR8UVbxl5XjQgyUMM6/I57yLlxze7si2IZlD/q9 VsKMNHHBm6PmImhXYmIp9hC+qMAchsC29wdpyk1l/BNXhb15KC+2ENOKkvpeflAxeHto oKww== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u37si33583396pga.301.2019.04.11.01.43.31; Thu, 11 Apr 2019 01:43:47 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbfDKIml (ORCPT + 99 others); Thu, 11 Apr 2019 04:42:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfDKIml (ORCPT ); Thu, 11 Apr 2019 04:42:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 342D23007452; Thu, 11 Apr 2019 08:42:41 +0000 (UTC) Received: from localhost (ovpn-12-112.pek2.redhat.com [10.72.12.112]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2231D5D961; Thu, 11 Apr 2019 08:42:37 +0000 (UTC) Date: Thu, 11 Apr 2019 16:42:35 +0800 From: Baoquan He To: Junichi Nomura Cc: Borislav Petkov , Dave Young , Chao Fan , Kairui Song , "x86@kernel.org" , "kexec@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4] x86/boot: Use efi_setup_data for searching RSDP on kexec-ed kernel Message-ID: <20190411084235.GJ3805@localhost.localdomain> References: <20190408231011.GA5402@jeru.linux.bs1.fc.nec.co.jp> <20190410171431.GE26580@zn.tnic> <7cbc096d-0548-18b1-a335-8ba114f234a7@ce.jp.nec.com> <20190411080927.GA30080@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 11 Apr 2019 08:42:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/19 at 08:16am, Junichi Nomura wrote: > On 4/11/19 5:09 PM, Borislav Petkov wrote: > > On Wed, Apr 10, 2019 at 11:34:51PM +0000, Junichi Nomura wrote: > >> But efi_get_rsdp_addr() needs to check whether the kernel was > >> kexec booted to avoid accessing invalid EFI table address. > >> efi_get_kexec_setup_data_addr() is the only method I know > >> to check if it was kexec-booted. > > > > Your v3 had the right approach - you first check if you can get the > > address as a kexec-ed kernel. If you do, you use that one and continue > > the normal path. > > > > If you don't, you fall back to efi_get_rsdp_addr() and get it directly > > from EFI. > > > > And then carve out the functionality you need to call multiple times in > > helper functions like __efi_get_rsdp_addr(). > > > > Why doesn't that work anymore? > > kexec_get_rsdp_addr() might fail on kexec-booted kernel, e.g. if the > setup_data was invalid. In such a case, falling back to efi_get_rsdp_addr() > will hit the problem of accessing invalid table pointer again. Seems you are trying to address Dave Young's comment in http://lkml.kernel.org/r/20190404073233.GC5708@dhcp-128-65.nay.redhat.com We may need discuss and make clear if those are doable. E.g the first comment, if not hang by below line of code, returning 0 for what? Can kexec still be saved, or just reset to firmware? error("EFI system table not found in kexec boot_params.") It may need be clarified firstly, then go further to rearrange patch. That can ease the work, I guess. Personal opinion. Thanks Baoquan