lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220817034559.44936-1-zhangtianci.1997@bytedance.com>
Date:   Wed, 17 Aug 2022 11:45:59 +0800
From:   Zhang Tianci <zhangtianci.1997@...edance.com>
To:     miklos@...redi.hu
Cc:     Zhang Tianci <zhangtianci.1997@...edance.com>,
        linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
Subject: [PATCH] ovl: Do not override fsuid and fsgid in ovl_link()

ovl_link() did not create a new inode after commit
51f7e52dc943 ("ovl: share inode for hard link"), so
in ovl_create_or_link() we should not override cred's
fsuid and fsgid when called by ovl_link().

Signed-off-by: Zhang Tianci <zhangtianci.1997@...edance.com>
Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@...edance.com>
---
 fs/overlayfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 6b03457f72bb..568d338032db 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -595,9 +595,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
 	err = -ENOMEM;
 	override_cred = prepare_creds();
 	if (override_cred) {
-		override_cred->fsuid = inode->i_uid;
-		override_cred->fsgid = inode->i_gid;
 		if (!attr->hardlink) {
+			override_cred->fsuid = inode->i_uid;
+			override_cred->fsgid = inode->i_gid;
 			err = security_dentry_create_files_as(dentry,
 					attr->mode, &dentry->d_name, old_cred,
 					override_cred);
-- 
2.32.1 (Apple Git-133)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ