From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aUEij-00067Y-MU for mharc-grub-devel@gnu.org; Fri, 12 Feb 2016 09:29:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUEig-00066h-UH for grub-devel@gnu.org; Fri, 12 Feb 2016 09:29:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUEif-0000cy-Tc for grub-devel@gnu.org; Fri, 12 Feb 2016 09:29:14 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:37219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUEif-0000ct-Ly for grub-devel@gnu.org; Fri, 12 Feb 2016 09:29:13 -0500 Received: by mail-wm0-x235.google.com with SMTP id g62so21823980wme.0 for ; Fri, 12 Feb 2016 06:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=0lwNQ/z9c4agqP47luez3nwo8e4K7qf9sF6UCg52+cQ=; b=m3KhgP1MGCb3CjzrqYXByg2PRLPkIvxP7SqWKcatf823ed247NW80p3jYOonsr0goA b6BQbb1Gv+IJ88+mNKq54EX7+B1QPVYkwjbt1osYTVzfa0z4TpF7D0Xp968HIk3J2w7u 1BLGyn0gt2fRn8ziWC8D0QK8b/a7WLFnbGT5lPHGr5MDcoytqpWBYefu21p1/RXYK1TG XCZfLeBQg/SM+ynsxokilmP87+tUxtrVi6mBnFeTwfLZxoTSOoxuh/ovHyUwIdBf/yyR MECqnKrHnoWzTZgLw+aCIRXGXdTMpCEc2xTAzxKAo23bGeaOVLpaTYmCTwlkJm9Jrl/n n66w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=0lwNQ/z9c4agqP47luez3nwo8e4K7qf9sF6UCg52+cQ=; b=JUQfzQr8ARb70lhquOgpAF3AljWiquFUN+3QrTCB7sUbbA5afBBY0kiTXGsDhy4lE4 ucYj8Nx+YJjy7/AEo9b4Y9NFM7Jl8uKx1vhvjMlnh5YXFl7LBcHKmUdshwfQA1T1/zcD sHtitfY6bx2uPSN/SZeM6n1wWba03DvaGymFDh1TWRYP2zpqum81xy8q0gVgXuEvZQYG fECCyDiImCSEMx9gzpJ3Id8I1UooZ7vKjKnTweVfzjHb9+UHVvVrXcGIqTtvrn1kEDd+ i5Hu2AhWa8R/km3rqkoXXy/SCLMP0Q14s+BnahC82TO+iYpKmzd5xN3WIgV0bKJ7L6vf /saA== X-Gm-Message-State: AG10YORDUqdttSmXt7LCuZ1HTVpFuw4SNk0HckWqZ5VSTI+5Qi9rWZ+F3apTh59QkemMeg== X-Received: by 10.28.218.145 with SMTP id r139mr5140075wmg.52.1455287352967; Fri, 12 Feb 2016 06:29:12 -0800 (PST) Received: from ?IPv6:2620:0:105f:fd00:a2a8:cdff:fe64:b3b5? ([2620:0:105f:fd00:a2a8:cdff:fe64:b3b5]) by smtp.gmail.com with ESMTPSA id g1sm7898735wmc.0.2016.02.12.06.29.11 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Feb 2016 06:29:11 -0800 (PST) Subject: Re: [PATCH] efidisk: prevent errors from diskfilter scan of removable drives To: The development of GNU GRUB References: <1454691380-8296-1-git-send-email-arvidjaar@gmail.com> From: =?UTF-8?Q?Vladimir_'=cf=86-coder/phcoder'_Serbinenko?= Message-ID: <56BDEC31.30409@gmail.com> Date: Fri, 12 Feb 2016 15:29:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <1454691380-8296-1-git-send-email-arvidjaar@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KrkO7n85P9stHDUPkg8IEWdVK9E0B77UT" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2016 14:29:15 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KrkO7n85P9stHDUPkg8IEWdVK9E0B77UT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05.02.2016 17:56, Andrei Borzenkov wrote: > Map EFI_NO_MEDIA to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter= =2E This > actually matches pretty close (we obviously attempt to read outside of = media) > and avoids adding more error codes. >=20 > This affects only internally initiated scans. If read/write from remova= ble is > explicitly requested, we still return an error and text explanation is = more > clear for user than generic error. >=20 > Reported and tested by Andreas Loew >=20 I feel like we should be fixing diskfilter. Consider another case: dead disk dangling on cable and returning mostly I/O errors > --- > grub-core/disk/efi/efidisk.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.= c > index 1c00e3e..ea75344 100644 > --- a/grub-core/disk/efi/efidisk.c > +++ b/grub-core/disk/efi/efidisk.c > @@ -547,7 +547,9 @@ grub_efidisk_read (struct grub_disk *disk, grub_dis= k_addr_t sector, > =20 > status =3D grub_efidisk_readwrite (disk, sector, size, buf, 0); > =20 > - if (status !=3D GRUB_EFI_SUCCESS) > + if (status =3D=3D GRUB_EFI_NO_MEDIA) > + return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'", d= isk->name)); > + else if (status !=3D GRUB_EFI_SUCCESS) > return grub_error (GRUB_ERR_READ_ERROR, > N_("failure reading sector 0x%llx from `%s'"), > (unsigned long long) sector, > @@ -568,7 +570,9 @@ grub_efidisk_write (struct grub_disk *disk, grub_di= sk_addr_t sector, > =20 > status =3D grub_efidisk_readwrite (disk, sector, size, (char *) buf,= 1); > =20 > - if (status !=3D GRUB_EFI_SUCCESS) > + if (status =3D=3D GRUB_EFI_NO_MEDIA) > + return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("no media in `%s'", d= isk->name)); > + else if (status !=3D GRUB_EFI_SUCCESS) > return grub_error (GRUB_ERR_WRITE_ERROR, > N_("failure writing sector 0x%llx to `%s'"), > (unsigned long long) sector, disk->name); >=20 --KrkO7n85P9stHDUPkg8IEWdVK9E0B77UT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREKAAYFAla97DEACgkQmBXlbbo5nOt3fAEAowqTMCbErGCgUq6RmOfZ/OV/ J+8lIdngJfTtyAUifggA/0objW5LiFjhd8kP5lJ94uKS/Al6HUu7VgQEAH7fnWtc =Y2KC -----END PGP SIGNATURE----- --KrkO7n85P9stHDUPkg8IEWdVK9E0B77UT--