Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2627284rdb; Fri, 8 Dec 2023 14:02:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmQnF3A8M9XX+OJRyFQA7lDgl1Rcqt6hvTmV0iJr9Jxxz7O8jvoI4TSgQMrkQ3QjWmzJ4f X-Received: by 2002:a92:d8c4:0:b0:35d:59a2:beb with SMTP id l4-20020a92d8c4000000b0035d59a20bebmr651597ilo.129.1702072924996; Fri, 08 Dec 2023 14:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702072924; cv=none; d=google.com; s=arc-20160816; b=JxqW7Acrd7P+MqnH1k2l5WDY3OP1/gBHSYTH2f0WU8+cIikV6zFytA7k/CbYU3rpAp 0yDMsYe9CPxuQcncuE4vz1rHXjcCwS9YyscCMkkjC944Jmof6SBsUOKAUl72IHAQM9rM Ls3cR80ZVD+1W9t0Ctigs+2XoJ1mOfBQwIkLmdiLtsLZIBgwgVqtNEh5MtSLo4dyciE1 FQYpFSwmlkjdO8xHe2xAGmxLF9WB2J3zHCOH42NRYVTr8eQALmEjPv2ogfDW2enrBVdB xYAkuzcwYQaO4YDEsFmJQZJGrVUN5uSd7yqStZARJ9pLEum1kRs/wOhLAccw58ewYCuL 3MLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gwRpCooCbgoz7HEZi5t2PEtOh3k8eEAoMS31q7RPeS8=; fh=Uws0H1nCZmYVUuuLsaGLNnaB83m72NJeOj4KbUYv8Ns=; b=ZUwokssR8EhjwOy0bdAaYGZBZ9OitixOeF7p5mBpgD3mU2a6iyhoRdh9SPSzq+uhgK VLDzPiU5ic1hLHw/B383C4DtvgIwnGo2zH3AB24/AkIzP192QmxJhso+uqeNzWPH75Cg K/Zm/4lOBzZ53GwvHvsbShsEw6cFKIj0xbwVZLl7Kat8sk1Boiv/0cF7UaghlDAp3zd3 zzASd5y7NUePuJ1punMJf0dSuI5X40kb99mo8rq/6xFoAWw3Yc85EHe7N9k7SOdR/PVO 9Npt54Q1dRS/ds+eqWbUEMN2IkckJj1eIBHvR/oIrCcqVH8cXuXAjwHH/Ikx0eNvA9aw wGkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JKAhh+wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id v7-20020a655687000000b005c6ac5b5fcfsi2171282pgs.736.2023.12.08.14.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 14:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JKAhh+wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 62BC38057955; Fri, 8 Dec 2023 14:01:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574822AbjLHWBS (ORCPT + 99 others); Fri, 8 Dec 2023 17:01:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574796AbjLHWBP (ORCPT ); Fri, 8 Dec 2023 17:01:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E8B10E0 for ; Fri, 8 Dec 2023 14:01:22 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A21C433C8; Fri, 8 Dec 2023 22:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702072881; bh=SNEIuK1x82a/ituBsnrXjG/P6Xh0PqqHypBFD2xqtKQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JKAhh+wz98l5nq5AMUM9KBCVxe786nbpWT05ZNlH3IVPCDVJua0Mus2Bwm7GCM6Mo D2QGnJZeO7CBR3qdK3Wely9K8VhPuB8QBJb0LSSZtVQnUCzx3pUG/kOKEuxaE3C0q4 YR97a1CJt9qex8GMpMrwqLyIv755Nnzqdd1hERKdeBajk/7p9/1WiA6+IKtvMAhUI5 zMjkYPvgTjUs4Nwb1aNValqVAJiHGLdLAhe+GIAOm+ncgDtp2qrca6sJi2b72hBYht lmMrwdyyLCQtwGWqr9C+oUmlug2zjNnou8UnNmbBcd0WB2yM99dImg1SOzFAKbxMlH mojxOyRHlqXEg== Date: Fri, 8 Dec 2023 23:01:15 +0100 From: Christian Brauner To: Amir Goldstein , Seth Forshee Cc: Roberto Sassu , miklos@szeredi.hu, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org, zohar@linux.ibm.com, paul@paul-moore.com, stefanb@linux.ibm.com, jlayton@kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Roberto Sassu Subject: Re: [RFC][PATCH] overlayfs: Redirect xattr ops on security.evm to security.evm_overlayfs Message-ID: <20231208-tauziehen-zerfetzt-026e7ee800a0@brauner> References: <20231208172308.2876481-1-roberto.sassu@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 14:01:32 -0800 (PST) On Fri, Dec 08, 2023 at 11:55:19PM +0200, Amir Goldstein wrote: > On Fri, Dec 8, 2023 at 7:25 PM Roberto Sassu > wrote: > > > > From: Roberto Sassu > > > > EVM updates the HMAC in security.evm whenever there is a setxattr or > > removexattr operation on one of its protected xattrs (e.g. security.ima). > > > > Unfortunately, since overlayfs redirects those xattrs operations on the > > lower filesystem, the EVM HMAC cannot be calculated reliably, since lower > > inode attributes on which the HMAC is calculated are different from upper > > inode attributes (for example i_generation and s_uuid). > > > > Although maybe it is possible to align such attributes between the lower > > and the upper inode, another idea is to map security.evm to another name > > (security.evm_overlayfs) > > If we were to accept this solution, this will need to be trusted.overlay.evm > to properly support private overlay xattr escaping. > > > during an xattr operation, so that it does not > > collide with security.evm set by the lower filesystem. > > You are using wrong terminology and it is very confusing to me. Same. > see the overlay mount command has lowerdir= and upperdir=. > Seems that you are using lower filesystem to refer to the upper fs > and upper filesystem to refer to overlayfs. > > > > > Whenever overlayfs wants to set security.evm, it is actually setting > > security.evm_overlayfs calculated with the upper inode attributes. The > > lower filesystem continues to update security.evm. > > > > I understand why that works, but I am having a hard time swallowing > the solution, mainly because I feel that there are other issues on the > intersection of overlayfs and IMA and I don't feel confident that this > addresses them all. > > If you want to try to convince me, please try to write a complete > model of how IMA/EVM works with overlayfs, using the section > "Permission model" in Documentation/filesystems/overlayfs.rst > as a reference. I want us to go the other way. Make the overlayfs layer completely irrelevant for EVM and IMA. See a related discussion here: Subject: Re: [PATCH 09/16] fs: add vfs_set_fscaps() https://lore.kernel.org/r/ZXHZ8uNEg1IK5WMW@do-x1extreme Amir, if you have some time I'd appreciate a comment on that.