Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cK9Ki-0005eI-B0 for mharc-grub-devel@gnu.org; Thu, 22 Dec 2016 14:47:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cK9Kf-0005dm-AI for grub-devel@gnu.org; Thu, 22 Dec 2016 14:47:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cK9Ka-0003yN-3s for grub-devel@gnu.org; Thu, 22 Dec 2016 14:47:17 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:35503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cK9KZ-0003xV-Tk for grub-devel@gnu.org; Thu, 22 Dec 2016 14:47:12 -0500 Received: by mail-lf0-x242.google.com with SMTP id x140so3341489lfa.2 for ; Thu, 22 Dec 2016 11:47:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=/+wawUHKPTWsGH+x2uw2V2V6xvTuksM6j3lq+taPekA=; b=FQm8UWYgC2A/5oiDS1BlcuyteMQuon9xDzlhbVo0m40QzmzzcA8po/bQc/PfTAVlpO mXF7IaVraWWukaQBR7YmA9TE1hmhrsc9ElioI7KkW85K49lwIYMY7gl4o56DvJ6LgOdZ wJP/aoCu/42JHzM1XnHfVEGIGS8c4L+YjrXVd1LNsQ3mZBNCvVkANUiKu4s3s48xZPHE 2L9fQO8bCtQn/gRI4Z6ckwIBsdgoZ13Bw/hoYKgNgcoMVfOQ7NOkXLYV2Evaw7/5gj05 W7Fo0MWkM62iBkDYiPntUo8jF8UMQPPx9QgxOo/XTI843KqSEaW+N725qKoIEblHnXs3 bzow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/+wawUHKPTWsGH+x2uw2V2V6xvTuksM6j3lq+taPekA=; b=jEoZoZv6g7qsydY197TjcryUxJtiyTbzNDZddcGF7mjY69ss+P1Lu5B8pXAAVdda4q r/kiVYL209U3G8LQEmBCBWK+bT+i9hWcGoLzohzb6/V9s1LyfQxm3nOM/3dnEFjPDYjp WK5iO289017zHasYx/eR/WATPNvw2p7iaXv04d5n/m8m3mVAzKMg/WBBFdvv+k1+k8M+ kQTMskjXMNGzshhD6R5dXeVQS2J0LHIdJRk4U4kmnW7ZlejWcJ1mqnDK6AIm/EWMIdDg r9KY+3u7seg4laijEZMVdJrZXysQMCPUOIq/QR2lNPUTS39BuyX+j6X872Sec1YU7P6+ kO7Q== X-Gm-Message-State: AIkVDXKlXU8wOPaTJY8Bg8kL7Koj55GxxlE8fVYIj+SRRQiUsMfd8FXjM1SAfbKqo6axTQ== X-Received: by 10.25.162.198 with SMTP id l189mr4386650lfe.50.1482436030005; Thu, 22 Dec 2016 11:47:10 -0800 (PST) Received: from [192.168.1.44] (ppp109-252-90-110.pppoe.spdop.ru. [109.252.90.110]) by smtp.gmail.com with ESMTPSA id y25sm7291364lja.13.2016.12.22.11.47.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 11:47:09 -0800 (PST) Subject: Re: [PATCH] Fix fwpath in efi netboot To: grub-devel@gnu.org References: <20161219090904.GA21413@linux-9gqx.suse.de> From: Andrei Borzenkov Message-ID: <2103c1ea-92e9-9061-38f5-48f04e71a77a@gmail.com> Date: Thu, 22 Dec 2016 22:47:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161219090904.GA21413@linux-9gqx.suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::242 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 19:47:18 -0000 19.12.2016 12:09, Michael Chang пишет: > The path returned by grub_efi_net_config has already been stripped for the > directory part extracted from cached bootp packet. We should just return the > result to avoild it be stripped again. > > It fixed the problem that grub.efi as NBP image always looking for grub.cfg and > platform directory in upper folder rather than current one it gets loaded while > $prefix is empty. The behavior is inconsistent with other architecture and how > we would expect empty $prefix going to be in general. > > The only exception to the general rule of empty $prefix is that when loaded > from platform directory itself, the platform part is stripped thus upper folder > is used for looking up files. It meets the case for how grub-mknetdir lay out > the files under tftp root directory, but also hide away this issue to be > identified as it appears to be just works. Thanks! Committed with additional fix - move *path assignment after grub_efi_net_config. We may receive file_path from firmware (e.g. iPXE ROM does set it) and we leaked it this way. Actually, iPXE ROMs, at least those shipped with Ubuntu 16.04, break grub2 netboot in interesting way, by passing "wrong" handle to image - the one for base interface instead of the child that has PXE protocol. It took me quite some time to understand why I cannot netboot anymore ... > --- > grub-core/kern/efi/init.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c > index e9c85de..dfa35a2 100644 > --- a/grub-core/kern/efi/init.c > +++ b/grub-core/kern/efi/init.c > @@ -61,7 +61,10 @@ grub_machine_get_bootlocation (char **device, char **path) > *device = grub_efidisk_get_device_name (image->device_handle); > *path = grub_efi_get_filename (image->file_path); > if (!*device && grub_efi_net_config) > - grub_efi_net_config (image->device_handle, device, path); > + { > + grub_efi_net_config (image->device_handle, device, path); > + return; > + } > > if (*path) > { >