From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cnczR-0002gS-Rj for mharc-grub-devel@gnu.org; Mon, 13 Mar 2017 23:19:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnczQ-0002gL-1N for grub-devel@gnu.org; Mon, 13 Mar 2017 23:19:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnczL-0000wh-2e for grub-devel@gnu.org; Mon, 13 Mar 2017 23:19:12 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:33005) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnczK-0000vv-RJ for grub-devel@gnu.org; Mon, 13 Mar 2017 23:19:07 -0400 Received: by mail-lf0-x241.google.com with SMTP id r36so13183014lfi.0 for ; Mon, 13 Mar 2017 20:19:06 -0700 (PDT) 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=HS/hN12acX00Jnx+3cmmbiwT9mDYvabza23C7KF5rpo=; b=S91j8EfrzEGiqoQBLwZrkOMFqBsStUOmBeAlxGOSAUTVTUhNAVnSyl1cG/3zwBj4Lo Ns7dmatYnCHmZHTgBONfO46EKLdoaLwwTpcXsKrXSzFFalGdiMAjVeLEdl8vxNRfJg2U IYGxo2IylDsElTVLCEXQfRMR+EjdnWFvGep+KXOHscsKjD8STyWCO0Torvsz+RylCu2a yFPbbx9o0MSY29oi6jiCDKhsPNgnYDbmTjSVoACUuoPR7FQmBG7ZXt9UcfDiwNyitU6e jn4fWlupeqrZePTnY+MyltWTfha5Rj1QwrwVqZiRUUfRA4P2Y3iLxcQY7WnSVtE/HPfy Ia0A== 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=HS/hN12acX00Jnx+3cmmbiwT9mDYvabza23C7KF5rpo=; b=ef12j2ZzwAXvOSxW3+rqFn6nwTPfG90q2jkTfJZabhyR4S/HB0QjSA7Cv3mMdI6Kl/ Gkxf+iy4GLej6Mr8nYAGJcYGeoqW/j8FPKGtIWar96jJCbS0KGET8t9JpcgBSRLqni4N epMHSvWsAbl7sJa8kPQc9jru35bvd/eaaSaDfOmlEwPsVLT+B9gii38DegQcyJ9dpB3C lfdlq15H/HXUFp+HX/blz0Bs4qq/yiWdQkJs3evXA8Kiu+BTDeHzVzMZ3RKdzh22Y3S5 /UHwwTEVAyprotLZKTwXszoAILS+Ij/Ft5RhNOFRrcKgFxeK6XVUIWYcUfHNFvOOK7Nh YZug== X-Gm-Message-State: AMke39kItb7d+h0FE0XEAjCQrqhEb6AnRoOEiZpOnyvNWXUiqxzHjpYF+mUvSAz4D5a08g== X-Received: by 10.25.168.15 with SMTP id r15mr8391505lfe.70.1489461545637; Mon, 13 Mar 2017 20:19:05 -0700 (PDT) Received: from [192.168.1.6] (ppp109-252-90-38.pppoe.spdop.ru. [109.252.90.38]) by smtp.gmail.com with ESMTPSA id i18sm3931054lfe.16.2017.03.13.20.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Mar 2017 20:19:05 -0700 (PDT) Subject: Re: [PATCH] disk/efi: skip iPXE dummy block devices To: The development of GNU GRUB , jamin.collins@gmail.com References: <1489376702-5580-1-git-send-email-arvidjaar@gmail.com> <20170314030307.GA27844@linux-9gqx.suse.de> From: Andrei Borzenkov Message-ID: <257751b4-373c-a151-8685-b33b3eb2215a@gmail.com> Date: Tue, 14 Mar 2017 06:19:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170314030307.GA27844@linux-9gqx.suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::241 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: Tue, 14 Mar 2017 03:19:13 -0000 14.03.2017 06:03, Michael Chang пишет: > On Mon, Mar 13, 2017 at 06:45:02AM +0300, Andrei Borzenkov wrote: >> iPXE adds Simple File System Protocol to loaded image handle, as side >> effect it also adds Block IO protocol (according to comments, to work >> around some bugs in EDK2). GRUB assumes that every device with Block IO >> is disk and skips network initialization entirely. But iPXE Block IO >> implementation is just a stub which always fails for every operation >> so cannot be used. Attempt to detect and skip such devices. >> >> We are using media ID which iPXE sets to "iPXE" and block IO size in >> hope that no real device would announce 1B block ... >> >> Closes: 50518 >> >> @Vladimir, @Daniel - this is probably 2.02 material. We cannot use >> any device that advertises block size less than 512B anyway, so it >> should not cause regression for disk boot. >> >> It is my fault, I have seen it earlier but was busy with another problem >> so just worked around it to continue testing. >> >> --- >> grub-core/disk/efi/efidisk.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c >> index 3b79f7b..47a4e99 100644 >> --- a/grub-core/disk/efi/efidisk.c >> +++ b/grub-core/disk/efi/efidisk.c >> @@ -80,6 +80,15 @@ make_devices (void) >> /* This should not happen... Why? */ >> continue; >> >> + /* iPXE adds stub Block IO protocol to loaded image device handle. It is >> + completely non-functional and simply returns an error for every method. >> + So attempt to detect and skip it. Magic number is literal "iPXE" and >> + check block size as well */ >> + /* FIXME: shoud we close it? We do not do it elsewhere */ >> + if (bio->media && bio->media->media_id == 0x69505845U && > > It seems that BE to LE conversion is required here as it tests for 'EXPi' on LE > systems. > iPXE sets it to this literal number: #define EFI_MEDIA_ID_MAGIC 0x69505845 /** Dummy block I/O media */ static EFI_BLOCK_IO_MEDIA efi_block_io_media = { .MediaId = EFI_MEDIA_ID_MAGIC, .MediaPresent = TRUE, .ReadOnly = TRUE, .BlockSize = 1, }; > Thanks, > Michael > >> + bio->media->block_size == 1) >> + continue; >> + >> d = grub_malloc (sizeof (*d)); >> if (! d) >> { >> -- >> tg: (bcf3c55..) bug/50518 (depends on: master) >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >