Thread (82 messages) 82 messages, 7 authors, 2021-01-20

Re: [PATCH v5 22/42] open: handle idmapped mounts in do_truncate()

From: Christoph Hellwig <hch@infradead.org>
Date: 2021-01-19 22:40:24
Also in: linux-ext4, linux-fsdevel, linux-integrity, linux-security-module, linux-xfs, selinux

On Tue, Jan 12, 2021 at 11:01:04PM +0100, Christian Brauner wrote:
quoted hunk ↗ jump to hunk
@@ -930,8 +932,12 @@ void dump_truncate(struct coredump_params *cprm)
 
 	if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
 		offset = file->f_op->llseek(file, 0, SEEK_CUR);
-		if (i_size_read(file->f_mapping->host) < offset)
-			do_truncate(file->f_path.dentry, offset, 0, file);
+		if (i_size_read(file->f_mapping->host) < offset) {
+			struct user_namespace *mnt_userns;
+
+			mnt_userns = file_user_ns(file);
+			do_truncate(mnt_userns, file->f_path.dentry, offset, 0, file);
+		}
I think we can skip the local variable here.  In fact for all callers
of do_truncate except vfs_truncate a little file_truncate helper that
takes a struct file would help readability a lot.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help