From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k9npV-0003Ew-Pr for mharc-grub-devel@gnu.org; Sun, 23 Aug 2020 07:06:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9npU-0003E0-L6 for grub-devel@gnu.org; Sun, 23 Aug 2020 07:06:28 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:44031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9nnY-0000Go-6W for grub-devel@gnu.org; Sun, 23 Aug 2020 07:06:28 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id A90C658033F; Sun, 23 Aug 2020 07:04:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 23 Aug 2020 07:04:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=iKPjP4ho9CGEgDR7qpupgnDOCVc gl4thlJg1XoJtnsQ=; b=i5Y5a7v5uRAkifQ8KrEkjBH3JTmIZC10q/7qJc+6Z7o IXQWU89scnjHH69yHiZ9Jkub2PFqnSHVx0LNwh8d2RhQeL3PqUDR4NNEhzuYqWej /RnlZn6bTq810PvsCBT0e82Sjmbt4WHa9L06hUkZ0i1slhkxPWcLY4RScZAvprz3 ZoKwujb9ddE/AO43XpT4TjYqlGVeS9P5p++09r/2d4nNuuxHDK1bu3SZ1mEyTJCn EG0l7u9LkyTtaYVOrcpeGGMU6kjJ64DmkX5jzSk7nqbfvSLpl9cLsnSDSlRXt3bF m/3Svn+mSjhSb2IurRr/NzeVndiE2ZTf+8A3lFECBBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=iKPjP4 ho9CGEgDR7qpupgnDOCVcgl4thlJg1XoJtnsQ=; b=nrVuyXwvzot4wEPGYdDzi0 A/8hhs+j8wm/kmVOYJ3Vh7HfFJOF8INxDWhjwXRzNyBVB35eLg6TvrNIe4ttKbpv JJ8gqSB3qwKkf0ea5TvY2IEkJOLxiyx/dFyue84mfYmUFedjn5AmA/QI3WiTBOyS nn3JYB6hJ2x4MJgS8KRLFNQyfgPq3xViLh2kJTLU5aUp93Sq1821IeYsm4ygsf7E LHetK2ckrtzDQ7qGFp/WMZ9McAzVHXbwexF6mb/WuvHMlyBp9hUD5W8kDO8LcI4G /YsUV/BiPUZ+Mk1OGtcook/jyDBkDP+HXDHSEepoo2fSq1YiK49rDSREjiMB+whQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduiedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeehgefhtdefueffheekgfffudelffejtdfhvdejkedthfehvdelgfetgfdvtedthfen ucfkphepjeejrddukeefrdehkedrudelheenucevlhhushhtvghrufhiiigvpeeinecurf grrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm X-ME-Proxy: Received: from vm-mail.pks.im (x4db73ac3.dyn.telefonica.de [77.183.58.195]) by mail.messagingengine.com (Postfix) with ESMTPA id DAA843280059; Sun, 23 Aug 2020 07:04:16 -0400 (EDT) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 9b1144cd (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 23 Aug 2020 11:04:15 +0000 (UTC) Date: Sun, 23 Aug 2020 13:04:17 +0200 From: Patrick Steinhardt To: grub-devel@gnu.org Cc: Denis 'GNUtoo' Carikli , Glenn Washburn , Daniel Kiper Subject: [PATCH 7/9] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read Message-ID: <13d0720d6a282a1c1612289220e08b2026a3f51a.1598179677.git.ps@pks.im> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=66.111.4.224; envelope-from=ps@pks.im; helo=new2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/23 06:59:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 11:06:28 -0000 --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =46rom: Glenn Washburn Here dev is a grub_cryptodisk_t and dev->offset is offset in sectors of size native to the cryptodisk device. The sector is correctly transformed into native grub sector size, but then added to dev->offset which is not transformed. It would be nice if the type system would help us with this. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index b2c6e9a7d..76ec2d4b9 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -757,8 +757,8 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_= t sector, size, sector, dev->offset); =20 err =3D grub_disk_read (dev->source_disk, - (sector << (disk->log_sector_size - - GRUB_DISK_SECTOR_BITS)) + dev->offset, 0, + ((sector + dev->offset) << (disk->log_sector_size + - GRUB_DISK_SECTOR_BITS)), 0, size << disk->log_sector_size, buf); if (err) { --=20 2.28.0 --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl9CTTEACgkQVbJhu7ck PpRuohAAgO4v+nWdB6LZPMqWHZrxSImOLFQE2KuzIxYb3x9OJQwGzF7LYZud0q4b KvbEyufQBoEGXVULVj0q6qWTpTbAiTk0tgzczwY9hhINmxZpY/Ar09oSgJnGQf8g NLH3nZgjq7coOUBrcXEzk0EFjyHvLxFybWgIMJNSXM0GiQf4CcTgeASwwu+amKrr IHccWCx4xmL4TdUf0MkWW3EZqRDzbJoBxSsdHw1cWy1YtUq0a0o39W0i2gzmtxzr Nyd/XcxkKquTpcMwaIP0kLDjuTeBDuEz+JNbaLZl+QLpsvluZNaPUOuRoWK5bW6o ogDGmhZQZwncM0HSbGoiysVAUvWz1qGYy/+JfRUpZe9THv+mzLNjaOj/rnLfXxqH 61LYXdwGgBtOxIqhtlv83jty25x3U5NlPxf+vlonaWwbyiB7PtIx9IQXuowPfdf2 mri8Sy4tZhjutzYhFQqujB3aY/xntwPo42lJH3vZ7d2Iq3/FIU5i0rwot5qklBvU 2+rM1UgX6ux0Jq/b4cFXMXXPD/MmclaJ1pXBG6tOlz8oWXunas2os2xtxMt01i9G 1VFoAYRiozujxgMkSq/zNBqoQQ69/mGwRVALyE8Pivd/xw9BLeF4xcjE5YS2DnKb Q12IOAQbPyUKci6ooZMHcxbmi0oknM9zkOoZfwef3eReOzpjPn8= =JUMr -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--