Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2384935pxb; Sun, 15 Nov 2020 02:48:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy53ZggYO0h3JsjVIzmnvml7LvP6k3y0X5u6EBdLbmArZs4fqtnHjqAfWuPOacObQ3ygHmr X-Received: by 2002:a17:906:1411:: with SMTP id p17mr10490587ejc.102.1605437322904; Sun, 15 Nov 2020 02:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605437322; cv=none; d=google.com; s=arc-20160816; b=I4J1ZR5u1Yl8s0g5+s6vpv9IKCUsC5jHYstJSC5HCft3IL++SRjbC5EgS70dfok4zu zeeAk/FMblwPk+ANvg6uDEH14FMUeAaxOPQHf0sykP7kNw/rbr2H23XiMBdbZBpef/Lc 5APmzN4xdpXjQVr2SnTyPXUuy+MBp3JAVtIifojMiSfl9o4i+5/sHB+m5gj+/yylGMwa RGRNZ3HaV/WjZTWVmcvrEuPTxKKFTle33TN/eejo/OLcBoafB4qkalOCEFdlQ3NB/+V8 hLoYY0pOSijKNCEau/NoBqmbMY1RRsnensGgrXHq1jJouO3CqIRHUxx+1009m7lQ32Dj LKpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pgN4cm10fT8ZCxJUvlWuy4NHbAE/UlxM3GRXe/eAj0E=; b=AusILS8Klffkq0tDEMvXaCO/zqEtBhMrucXPQjNxoEXLZCjk3sbKS0SqPXG7685Oh/ 1nZBEfPOmncrBzGnfIWT1KB7mIqeR30isASwBsXzTQppRJFfRJmsdpl9ijTQAhrF68ee cZVeuR8KysNwjabgbI1XAPUwY/jt+7gNpmO3xm1H5FThhZuLKCJLqPzwBJgINYsRdetw OwflmkGyq4qDpFJbg+OJfBkyiKUQhqvIr+oSR7wN2drzTQ++NWhPzu7HVSEnOYjfKqEC MxzaM/gFOxATF/EqFNOxkf6i9lmd4g27CTQ11aRFdlECl7YrpmyvtrIy/XAONN5Dq5i5 rKbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si12010083ejq.4.2020.11.15.02.48.19; Sun, 15 Nov 2020 02:48:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbgKOKsE (ORCPT + 99 others); Sun, 15 Nov 2020 05:48:04 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:59832 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727076AbgKOKsC (ORCPT ); Sun, 15 Nov 2020 05:48:02 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1keFRI-0000Kt-US; Sun, 15 Nov 2020 10:39:21 +0000 From: Christian Brauner To: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org Cc: John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Jann Horn , Seth Forshee , =?UTF-8?q?St=C3=A9phane=20Graber?= , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Jonathan Corbet , containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-audit@redhat.com, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, Christian Brauner , Christoph Hellwig Subject: [PATCH v2 22/39] utimes: handle idmapped mounts Date: Sun, 15 Nov 2020 11:37:01 +0100 Message-Id: <20201115103718.298186-23-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115103718.298186-1-christian.brauner@ubuntu.com> References: <20201115103718.298186-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Enable the vfs_utimes() helper to handle idmapped mounts by passing down the mount's user namespace. Cc: Christoph Hellwig Cc: David Howells Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner --- /* v2 */ unchanged --- fs/utimes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/utimes.c b/fs/utimes.c index 1a4130bee157..ead17d623aaa 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -22,6 +22,7 @@ int vfs_utimes(const struct path *path, struct timespec64 *times) struct iattr newattrs; struct inode *inode = path->dentry->d_inode; struct inode *delegated_inode = NULL; + struct user_namespace *user_ns; if (times) { if (!nsec_valid(times[0].tv_nsec) || @@ -61,8 +62,9 @@ int vfs_utimes(const struct path *path, struct timespec64 *times) newattrs.ia_valid |= ATTR_TOUCH; } retry_deleg: + user_ns = mnt_user_ns(path->mnt); inode_lock(inode); - error = notify_change(&init_user_ns, path->dentry, &newattrs, &delegated_inode); + error = notify_change(user_ns, path->dentry, &newattrs, &delegated_inode); inode_unlock(inode); if (delegated_inode) { error = break_deleg_wait(&delegated_inode); -- 2.29.2