Received: by 10.213.65.68 with SMTP id h4csp683009imn; Tue, 20 Mar 2018 12:38:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELtpLvY82lRlV/VvglDWvnKzJVwppW+v4NLWK237R4J4DrZ5RfnWBpaWzUaSzhAXPIraw9Zi X-Received: by 2002:a17:902:bd05:: with SMTP id p5-v6mr17744680pls.137.1521574687769; Tue, 20 Mar 2018 12:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521574687; cv=none; d=google.com; s=arc-20160816; b=G1aPxSTQh3T7HetQtgWpUIPRAtEJED9YH73d2OthcJEvlOiotGlAzoozA1a33uh8FF hfZOIYseNSv9LO725MxPgdtFmqbVY4haJQnaVqASFfpLZ8xUTxugg0HJlGMCEjfrW51I r3uz3wADKjs8E6t7orChw/Q1l6sOjvqxLou1eaQdG1de/YzMx/ojSJjMZhS9eznztPEJ 5+/arIyeUdCnCfRL0+HoqATj5/BJcoxbMMhpoJVoIVZzERzLeFFCcE7LdHUDVdQmPGkQ NzeSBRfenHbMbLv6l43H9RDDGRPAF3MdTIkmckfVn1hILNyZMtJnz6qwnk4XR+l/KnJI ZurA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=iVOTYm3hzmPZzNhC0XyuyJckFWCPdL4D27vfLyhhybU=; b=Kc5sZZ66efgsUbc/Er+VO5J0RDjfsHLAl951iJah44U0DchwdtuTxm+5g5rX94ukeR ULVBJjyOLTUcaS/r0Z+vcXOpyV9jqH8MFtU12W2cVEFtnFfhgT8bVNOWTfv6rGVrRjhE VRx4z5D55sT6zno0kvnWPNp9Y/1xPshYe0zeVFpu47E9UXCGEeZrzpAW2oHO3ujUl9Hz 5V1sxgh2mQ0sfqiimpQRMRG28Fi4PWhAkJmY2wzX6sow7kk/au9Wn9SThPAfi9ujg9Ov CnGR1VZDkZWCjfcXDjYFelofjG2f1Rb3khkYSf7rkz1/6VfIdKlcWZzCcFqVW8/BD6jh O5Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73-v6si2253384plh.393.2018.03.20.12.37.51; Tue, 20 Mar 2018 12:38:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbeCTTgt (ORCPT + 99 others); Tue, 20 Mar 2018 15:36:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45568 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751320AbeCTTgr (ORCPT ); Tue, 20 Mar 2018 15:36:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89D227705E; Tue, 20 Mar 2018 19:36:46 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DB3410B0F50; Tue, 20 Mar 2018 19:36:44 +0000 (UTC) Date: Tue, 20 Mar 2018 15:36:43 -0400 From: Mike Snitzer To: Patrik Torstensson , Eric Biggers Cc: gkaiser@google.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, samitolvanen@google.com, Alasdair Kergon , paulcrowley@google.com Subject: Re: Add an option to dm-verity to validate hashes at most once Message-ID: <20180320193643.GA11080@redhat.com> References: <20180306231456.210504-1-totte@google.com> <20180314190957.GB183724@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180314190957.GB183724@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 19:36:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 19:36:46 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'msnitzer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 14 2018 at 3:09pm -0400, Eric Biggers wrote: > Hi Patrik, > > On Tue, Mar 06, 2018 at 03:14:56PM -0800, Patrik Torstensson wrote: > > Add an option to dm-verity to validate hashes at most once > > to allow platforms that is CPU/memory contraint to be > > protected by dm-verity against offline attacks. > > > > The option introduces a bitset that is used to check if > > a block has been validated before or not. A block can > > be validated more than once as there is no thread protection > > for the bitset. > > > > This patch has been developed and tested on entry-level > > Android Go devices. > > > > Signed-off-by: Patrik Torstensson > > --- > > drivers/md/dm-verity-target.c | 58 +++++++++++++++++++++++++++++++++-- > > drivers/md/dm-verity.h | 1 + > > 2 files changed, 56 insertions(+), 3 deletions(-) > > The new option needs to be documented in Documentation/device-mapper/verity.txt, > including a description of what the option does as well as how it affects the > security properties of dm-verity. There should also be a mention of why the > option applies to data blocks but not hash blocks, assuming that's intentional. > > verity_status() also needs to be updated to show the new option, otherwise it > will not be visible via the DM_TABLE_STATUS ioctl ('dmsetup table' on the > command line). > > Also the minor version number in the struct target_type needs to be incremented, > so that userspace can determine whether the option is supported. > > > > > for (b = 0; b < io->n_blocks; b++) { > > int r; > > + sector_t cur_block = io->block + b; > > struct ahash_request *req = verity_io_hash_req(v, io); > > > > + if (v->validated_blocks && > > + likely(test_bit(cur_block, v->validated_blocks))) { > > + verity_bv_skip_block(v, io, &io->iter); > > + continue; > > + } > > + > > r = verity_hash_for_block(v, io, io->block + b, > > Can you replace 'io->block + b' with 'cur_block' here as well? Patrik, any chance you could act on Eric's review feedback and post v2 of this patch (assuming you still have a need for it)? Thanks, Mike