From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Zv5ov-00038k-0Q for mharc-grub-devel@gnu.org; Sat, 07 Nov 2015 10:54:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv5os-00038F-Cy for grub-devel@gnu.org; Sat, 07 Nov 2015 10:54:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zv5on-0005It-Cx for grub-devel@gnu.org; Sat, 07 Nov 2015 10:54:22 -0500 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]:35854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv5on-0005IJ-5e for grub-devel@gnu.org; Sat, 07 Nov 2015 10:54:17 -0500 Received: by lbblt2 with SMTP id lt2so56347349lbb.3 for ; Sat, 07 Nov 2015 07:54:16 -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:content-transfer-encoding; bh=teisdZdhcRNRw+5TPO0V71AkfVWWWyUdTxzDMYz0gRI=; b=dzB5/xI2c+2dyjuJwc5mNmHL8Gd+hAH/mQIxoOloTN8AEvKR9tJ/oysmLbensX8nnJ Owqf3Arqt6PN6cHUtb2QtUJkkbx5xtrpUEXeFi2lP9QkIA3OnLN5tZJPRMk+80xuKiLI fzXfL5k/3VPZJPGBdBQjmhVQL+8w+ljHyib/o6+/2HrRVjE+2QwsXlf8Ee4EU2UdqfTJ csf9QYEyaqvfSY7DUHhjskgvnrUct9B0B5+RyFtuLzMbff8kzuotgvRLmIZdWEUlHz2f 9EucZrA8AbBUkb0m9D37XmDGR8xnMow8vc3xokIBEdWsIjFMy74nJMVVt23jD7C1vcwb H/zw== X-Received: by 10.112.72.40 with SMTP id a8mr10259371lbv.55.1446911656372; Sat, 07 Nov 2015 07:54:16 -0800 (PST) Received: from [192.168.1.41] (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id q1sm900422lbb.5.2015.11.07.07.54.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Nov 2015 07:54:15 -0800 (PST) Subject: Re: cryptodisk: teach grub_cryptodisk_insert() about partitions (bug #45889) To: The development of GNU GRUB References: <55EF0EFB.5060103@gmail.com> <55F2E119.8020302@gmail.com> <1bdb53606c12c9360f05ba5995791018@iam.tj> From: Andrei Borzenkov Message-ID: <563E1EA6.5010700@gmail.com> Date: Sat, 7 Nov 2015 18:54:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1bdb53606c12c9360f05ba5995791018@iam.tj> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::230 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: Sat, 07 Nov 2015 15:54:23 -0000 I committed your patch. Thank you! 11.09.2015 17:54, TJ пишет: > > > On 11-09-2015 15:11, Andrei Borzenkov wrote: >> 09.09.2015 04:18, TJ пишет: >>> On 08-09-2015 17:38, Vladimir 'φ-coder/phcoder' Serbinenko wrote: >>>> On 06.09.2015 21:10, TJ wrote: >>>>> https://savannah.gnu.org/bugs/index.php?45889 >>>>> + if ((disk->partition && disk->partition->number == >>>>> dev->partition_number) || >>>>> + (!disk->partition && dev->partition_number == 0)) >>>>> + return dev; >>>> Please store and compare partition start, not parition number as the >>>> same partition can be available several times through different >>>> partiton >>>> schemes under different numbers. Additionally this allows to use >>>> get_partition_start which already has the logic of handling empty >>>> partitions >>> >>> Done and tested. Works perfectly. >>> >> >> Well, should not it also compare disk sizes (grub_disk_get_size)? >> Also grub_partition_get_start cannot differentiate between full disk >> (start == 0) and partition that starts at offset 0. > > My original patch differentiated based on partition_number == 0 > indicating a non-partitioned disk (assuming 1-based partition numbers). > > Vladimir asked me to use grub_partition_get_start() due to multiple > partitioning schemes. I was concerned the function has no concept of an > error indicator but as it returns 0 when no partitions are found that is > equivalent (although it could be argued it has dual-use if it is > possible for a partition to start at sector 0). > > In grub_cryptodisk_insert() partition_start == 0 means it is a whole disk. > > In this if() clause the disk has already been confirmed identical and so > the only question is whether the cryptodisk is a whole-disk or a > partition, and if so which partition. > > As the starting sector is being stored and that is a unique value > per-disk, regardless of if there are multiple partition schemes (e.g. > GPT + Hybrid MBR) the starting sectors will be identical. > > If the partition lengths are different (in the multiple partition > schemes) isn't that a bug in the partitioning and something grub doesn't > need to concern itself about? > > In the event of the partition matching failing the function behaves as > it has done previously, returning the whole device. > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel