From patchwork Thu Jul 6 20:41:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1804496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=Jfnqu7Pk; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QxpNl4sRXz20bY for ; Fri, 7 Jul 2023 06:41:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qHVnX-0000uj-4i; Thu, 06 Jul 2023 20:41:55 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qHVnV-0000uH-Qd for kernel-team@lists.ubuntu.com; Thu, 06 Jul 2023 20:41:53 +0000 Received: from localhost.localdomain (1.general.cascardo.us.vpn [10.172.70.58]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 9AFDD4214C for ; Thu, 6 Jul 2023 20:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1688676113; bh=1edLcZtQA6MmXRYbi/ablgydxgBK7p/iFnZUBPDPW3A=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jfnqu7PkQP4Kq1r4zV/JcTuLckwanWZojEF+1omj+zJ6Z6/ZyDnUb0Ghvb+3GAY2m e59rDhRwq3nTghPz9VZMHlkMChhv21/7PbqXZAEIHaRJ0gcRw6VI5z2rL4MT4jA4BD yCWxf/o6qOiCAmiikBYbNkbJkkIeNJI4XW4zVs2TpzxodTAPRZ37nV/s+1UHzZ5Og6 V70jYEbXqKnq+90oi23Cmp45h43k5Abb8bLklTjUfYNYWQy5PJhSAzECpHfvJ/uSW5 TpyEs/Rs4Y5Fn/VqZB8+3pk680GDd6W06WYEi2FsCkrXam3ge7Zk43YN3EnA3CEdG2 ISJPgvEqx5r5g== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU Focal 1/1] ovl: adhere to the vfs_ vs. ovl_do_ conventions for xattrs Date: Thu, 6 Jul 2023 17:41:02 -0300 Message-Id: <20230706204102.1071329-2-cascardo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230706204102.1071329-1-cascardo@canonical.com> References: <20230706204102.1071329-1-cascardo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Miklos Szeredi Call ovl_do_*xattr() when accessing an overlay private xattr, vfs_*xattr() otherwise. This has an effect on debug output, which is made more consistent by this patch. Signed-off-by: Miklos Szeredi (cherry picked from commit 7109704705a4d80516de00779bba38b3844bff13) CVE-2023-32629 Signed-off-by: Thadeu Lima de Souza Cascardo --- fs/overlayfs/copy_up.c | 6 +++--- fs/overlayfs/super.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 60bf2066b819..fcb1a623d8f6 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -784,14 +784,14 @@ static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c) * don't want that to happen for normal copy-up operation. */ if (capability) { - err = ovl_do_setxattr(upperpath.dentry, XATTR_NAME_CAPS, - capability, cap_size, 0); + err = vfs_setxattr(upperpath.dentry, XATTR_NAME_CAPS, + capability, cap_size, 0); if (err) goto out_free; } - err = vfs_removexattr(upperpath.dentry, OVL_XATTR_METACOPY); + err = ovl_do_removexattr(upperpath.dentry, OVL_XATTR_METACOPY); if (err) goto out_free; diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index aed79f56d4b8..ebf5da36eef6 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1137,7 +1137,7 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs, pr_warn("overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.\n"); err = 0; } else { - vfs_removexattr(ofs->workdir, OVL_XATTR_OPAQUE); + ovl_do_removexattr(ofs->workdir, OVL_XATTR_OPAQUE); } /* Check if upper/work fs supports file handles */