From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3C7BC04A6A for ; Sun, 13 Aug 2023 16:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232992AbjHMQLL (ORCPT ); Sun, 13 Aug 2023 12:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232796AbjHMQKd (ORCPT ); Sun, 13 Aug 2023 12:10:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899822D42; Sun, 13 Aug 2023 09:10:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A58463962; Sun, 13 Aug 2023 16:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C28BAC433C9; Sun, 13 Aug 2023 16:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691942934; bh=NS8BRsPezJRxfb8/o9K3dwAAXswAOv7memJUVJWCtQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzHWLJvWZnsg+M0XEVOauYAfP5Nyc7lcvWPTSxDPYw6t+VV4ECwxbYHJSJon2DXBi MtkU2PANxVlUHIhaKukqvcorPhzJE1Ct+PXRSLW6qTWJ5/QM1TAoO83jP4OFsC9gsl GK2pOIP4XPa4mpPAbdN9jrXNruP2jeCQ5lvPAXghjBHYleYKZYhSPcqCJJu7nhrkoU mDLWLzK+8Oshg/YIiiAMk23GwPXqYnpo0/slSg7kQAgs/XSAdmEqHrkMwxh5wiZEyf GiF9fXvTnIMmsduelCc98YwNw7SliExWY+JIkl/ztK8x1W2T+DE6WJ6ZfPShytsLpx ubKJxxNIrv/mw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Snowberg , Mimi Zohar , Linus Torvalds , Sasha Levin , miklos@szeredi.hu, amir73il@gmail.com, linux-unionfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 26/31] ovl: Always reevaluate the file signature for IMA Date: Sun, 13 Aug 2023 12:05:59 -0400 Message-Id: <20230813160605.1080385-26-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230813160605.1080385-1-sashal@kernel.org> References: <20230813160605.1080385-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.126 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Snowberg [ Upstream commit 18b44bc5a67275641fb26f2c54ba7eef80ac5950 ] Commit db1d1e8b9867 ("IMA: use vfs_getattr_nosec to get the i_version") partially closed an IMA integrity issue when directly modifying a file on the lower filesystem. If the overlay file is first opened by a user and later the lower backing file is modified by root, but the extended attribute is NOT updated, the signature validation succeeds with the old original signature. Update the super_block s_iflags to SB_I_IMA_UNVERIFIABLE_SIGNATURE to force signature reevaluation on every file access until a fine grained solution can be found. Signed-off-by: Eric Snowberg Signed-off-by: Mimi Zohar Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/overlayfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 5310271cf2e38..e18025b5c8872 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -2140,7 +2140,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ovl_trusted_xattr_handlers; sb->s_fs_info = ofs; sb->s_flags |= SB_POSIXACL; - sb->s_iflags |= SB_I_SKIP_SYNC; + sb->s_iflags |= SB_I_SKIP_SYNC | SB_I_IMA_UNVERIFIABLE_SIGNATURE; err = -ENOMEM; root_dentry = ovl_get_root(sb, upperpath.dentry, oe); -- 2.40.1