Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp989045imm; Fri, 14 Sep 2018 09:22:21 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbjy8ps/qlMwjk0a3eJHsqSLPmDPSLMk5L/vSIpsCWTSLSTibvfJTa79Lyr0glyqPtXElME X-Received: by 2002:a17:902:bc43:: with SMTP id t3-v6mr73287plz.199.1536942141755; Fri, 14 Sep 2018 09:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536942141; cv=none; d=google.com; s=arc-20160816; b=P/qXrplKxlTXAfr+IWsCPk1FCpni3OeNLI0Us9Fl1sjzDN3s0b2ZcR4nTy8GjU4Vrk EDEkIJE8NVEuOmj3oCyNnk6lJ4LFed+q7YmxQD+J5cQPT6N4IFy/zvMF6diXHBEVAr1J hpepPMe6z3XY4LQ0/dkkd8fd+cVKxHxWHrDr0JohAIkgJVJF25hj88B6zw/lcc5RKuda jGOtfebGUJM4aPgKeULhI2nc4YDsL5pf8Pi0OzYDutOae0I/3E/CiZed1U2acKSrTm/R jJdOWDVKmIQqU6D6RMPIFoLFyWUW+qdW+i99r4JC/eldiyO7rv93WGi7PY34NXtY09uN K4Vg== 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:dkim-signature; bh=xOZVw5b6DSnE9lnesZ7/mdZ3R6qaqh/8oH+I/wqqBUI=; b=gzZmzS22cJOyIsy4kBRHJfbJPMjhmfMMAtITuIn7Qw3mjrjH/cHw8/oYEDtJl4Ku/S OPpPi9q2PmjWDF0CU0c8dKjIXxHzf6Ut5aEJjYhiFgvnaDoC7vPY+Ual1O41TChP+50B UFSvashMIpCOw46FfLpTzwJWN0GpwL99lsd+TNhCsbJ/4eZ1J8mKG+pruHsLOAQFOPoT rlSPXJ0HWnbf4MWqQWoK8eHs4m8iIVliugKt/uT56l5ffmALlmkmtZ43qOwEkyHc306D jKMJkHiUEeKcyXxxpLUDn5TDmpOOgqhBqXokZ//6IFphde0Qwez+rQHGIJNMGxPUeuiN iwgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WJNW/Z5I"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11-v6si7204429plk.490.2018.09.14.09.22.05; Fri, 14 Sep 2018 09:22:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b="WJNW/Z5I"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728319AbeINVg5 (ORCPT + 99 others); Fri, 14 Sep 2018 17:36:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:38236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbeINVg5 (ORCPT ); Fri, 14 Sep 2018 17:36:57 -0400 Received: from sol.localdomain (c-67-185-97-198.hsd1.wa.comcast.net [67.185.97.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDC2A2083A; Fri, 14 Sep 2018 16:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536942105; bh=l/MtbRycAf5F2mkJ/Zzh+1W2fM7r4fKUik1yNIhWp8M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WJNW/Z5IdCRRz5aSWS/XHrqiOqjq3mlUEroI/13F5CjcLIbIMc8V9AkEx4puthRli OMYrExa8N+0X3ogoHPrcX0fSq9OxdzjVahN2NLTsA5dXBhc8petNm2iV2MEI8DdZyu vQSB2xvcxPdJBY/ysLRWDQxCmugePEllfZ+xx4KM= Date: Fri, 14 Sep 2018 09:21:43 -0700 From: Eric Biggers To: Colin Walters Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-integrity@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, Mimi Zohar , Dmitry Kasatkin , Michael Halcrow , Victor Hsieh Subject: Re: [RFC PATCH 01/10] fs-verity: add setup code, UAPI, and Kconfig Message-ID: <20180914162142.GA734@sol.localdomain> References: <20180824161642.1144-1-ebiggers@kernel.org> <20180824161642.1144-2-ebiggers@kernel.org> <1535132549.2855027.1485213752.129E3334@webmail.messagingengine.com> <20180825044852.GB726@sol.localdomain> <1536930930.1003187.1508104496.6465C44D@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1536930930.1003187.1508104496.6465C44D@webmail.messagingengine.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 Hi Colin, On Fri, Sep 14, 2018 at 09:15:30AM -0400, Colin Walters wrote: > On Sat, Aug 25, 2018, at 12:48 AM, Eric Biggers wrote: > > > > As Ted pointed out, only truncates are denied on fs-verity files, not other > > metadata changes like chmod(). > > > > Think of it this way: the purpose of fs-verity is *not* to make files immutable. > > It's to hash them. > > Sorry for my unfamiliarity with Android internals but - in earlier discussion > I believe it was mentioned that APK (zip files?) that are being targeted here, right? > > Now AIUI, Zip files have an internal header that contains e.g. the size and > indexes into the internal files. So if someone added random data to the end > of a zip file, nothing is going to end up actually reading it. > > However, there are file formats that use the size of the file reported by stat(); > at least OSTree does this with serializing GVariant. I'm sure there are others - > I'd imagine at least some things parsing ELF do this? > In such a case, we really want to deny appending to the file as well. > > Unless there's some mechanism to deny applications reading not-verified > data? > > And "hidden" data after fs-verity protected files would be a nice place > for persistent malware to hide. > > Does anyone know of a use case for appending to a fs-verity file? > > The slides here: > https://events.linuxfoundation.org/wp-content/uploads/2017/11/fs-verify_Mike-Halcrow_Eric-Biggers.pdf > even say "File becomes read-only!" > > If not, then here's a strawman: Require that at FS_IOC_ENABLE_VERITY time > the file does not have any +w bits set (and I guess no ACLs that do so... > that may get ugly). > > I think that would make it easier to later factor out a "_CONTENTS_IMMUTABLE" > flag. > After the verity bit is enabled, the verity metadata is not visible to userspace. Yes, that means i_size is adjusted too. Also all contents modifications are denied, including appends. - Eric