Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3955422ybl; Mon, 26 Aug 2019 03:14:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvX9tWpydcTREdCaB8EsCafXKwk+/pFnNTLxuosaWAImz4vXZymgjEzvXe5FMblLO3/4Mx X-Received: by 2002:a17:90b:949:: with SMTP id dw9mr2921100pjb.49.1566814451834; Mon, 26 Aug 2019 03:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566814451; cv=none; d=google.com; s=arc-20160816; b=zvP9CCTrGBySDX6w74R9hCj8eFln7U8faDMe+1icfxbriXAslMcMFwnlz3UfU9/xbm fkitSx/N3FLQS+5DoeUnMKqCkzSwvpqdfACXs4xOtC4CipMJ6fi7TlPZjE/Pkh5UtjG5 UYqo4fhzqGd2z0zT0lUiTx0+jdzwTgUH23YgPfN0nT/lI8R8pSTOyR+fPYI+qt9M0wqU QJ1BOT8Ncc3SfrHtkdeg2z5R67Ol1sWHGmcI/VVm5A7LdJgi/v4xN9GClnqQ8FYQDnjB U2wQhYndHUCOxiVY5+wQHziCVAxPEAndMxhWqay6cZG7xi5cE09aCqEBYwHKTmZp3X97 l5CA== 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; bh=krjkg3183Zro6L3if0dOt6KCGm9SAQq2Bn+94SczcPw=; b=uJaWB/1v5Zx4ia8I2puyNsaBnwXeZUgLbESJCoHlW3CYiLHAC0IOc00ejcG1IWNHVS CxrX4Jbm/hwU33pdxIxtUKV+QqRmtfqsfJcVOEQW59lvoLABbzXJzVHVbLLzJ9fcPPGD LjRcH/Kp5KM519VdVpcSflB8XpxXbTe2LEXfKHh/dgNrTA+5Fb1Wy9vVOm1ArMASRHJW 1CR83Ir6Rd9VE1bgg8L5ilSbUjsd8MD7+TA50+Q61W67xcelXmwWtPUkhNjnxKwB3EDW c5eddAUgS/yGClKiqvkSc5ou0SvRc/vER8XHi3ISdy5vKZZyZZraQGa+o+25wK0ReI9h qBLg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si8513975pgi.430.2019.08.26.03.13.56; Mon, 26 Aug 2019 03:14:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730788AbfHZJOX (ORCPT + 99 others); Mon, 26 Aug 2019 05:14:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:59950 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726354AbfHZJOX (ORCPT ); Mon, 26 Aug 2019 05:14:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 215D1AC7F; Mon, 26 Aug 2019 09:14:22 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 9E4971E3FE3; Mon, 26 Aug 2019 11:14:21 +0200 (CEST) Date: Mon, 26 Aug 2019 11:14:21 +0200 From: Jan Kara To: Steve Magnani Cc: Jan Kara , Jan Kara , "Steven J . Magnani" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] udf: reduce leakage of blocks related to named streams Message-ID: <20190826091421.GB10614@quack2.suse.cz> References: <20190814125002.10869-1-steve@digidescorp.com> <20190815124218.GE14313@quack2.suse.cz> <4169b326-a8ff-5fc4-0e5e-393569273267@digidescorp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4169b326-a8ff-5fc4-0e5e-393569273267@digidescorp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 19-08-19 07:10:24, Steve Magnani wrote: > Jan - > > > On 8/15/19 7:42 AM, Jan Kara wrote: > > On Wed 14-08-19 07:50:02, Steven J. Magnani wrote: > > > Windows is capable of creating UDF files having named streams. > > > One example is the "Zone.Identifier" stream attached automatically > > > to files downloaded from a network. See: > > > https://msdn.microsoft.com/en-us/library/dn392609.aspx > > > > > > Modification of a file having one or more named streams in Linux causes > > > the stream directory to become detached from the file, essentially leaking > > > all blocks pertaining to the file's streams. > > > > > > Fix by saving off information about an inode's streams when reading it, > > > for later use when its on-disk data is updated. > > > > > > } else { > > > inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << > > > (inode->i_sb->s_blocksize_bits - 9); > > > @@ -1498,6 +1502,16 @@ reread: > > > iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); > > > iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); > > > iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); > > > + > > > + /* Named streams */ > > > + iinfo->i_streamdir = (efe->streamDirectoryICB.extLength != 0); > > > + iinfo->i_locStreamdir = > > > + lelb_to_cpu(efe->streamDirectoryICB.extLocation); > > > + iinfo->i_lenStreams = le64_to_cpu(efe->objectSize); > > > + if (iinfo->i_lenStreams >= inode->i_size) > > > + iinfo->i_lenStreams -= inode->i_size; > > > + else > > > + iinfo->i_lenStreams = 0; > > Hum, maybe you could just have i_objectSize instead of i_lenStreams? You > > use the field just to preserve objectSize anyway so there's no point in > > complicating it. > > > > I started making this change and found that it actually complicates things more, > by forcing the driver to update i_objectSize everywhere that i_size is changed. > Are you sure this is what you want? Aha, that's a good point! No, in that case what you did was better. I'll just take your v2 patch then, I can make the other minor adjustments I was suggesting when applying the patch. Thanks for looking into this! Honza -- Jan Kara SUSE Labs, CR