Skip to contentSkip to conversation

linux-next: manual merge of the y2038 tree with the xfs tree

PATCH Stephen Rothwell 2 participants 4 messages Oct 30, 2019 – Dec 3, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the y2038 tree got a conflict in:

fs/compat_ioctl.c

between commit:

837a6e7f5cdb ("fs: add generic UNRESVSP and ZERO_RANGE ioctl handlers")

from the xfs tree and commits:
011da44bc5b6 ("compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c") 37ecf8b20abd ("compat_sys_ioctl(): make parallel to do_vfs_ioctl()")

from the y2038 tree.

I fixed it up (see below and the added patch) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

From af387ea192196ffd141234e7e45bcfbc2be1a4fc Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email protected]>
Date: Wed, 30 Oct 2019 15:05:29 +1100
Subject: [PATCH] fix up for "compat: move FS_IOC_RESVSP_32 handling to
fs/ioctl.c"

---
 fs/ioctl.c             | 4 ++--
 include/linux/falloc.h | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
fs/ioctl.c +2 -2
index 455ad38c8610..2f5e4e5b97e1 100644
@@ -495,7 +495,7 @@ int ioctl_preallocate(struct file *filp, int mode, void __user *argp)
 /* on ia32 l_start is on a 32-bit boundary */
 #if defined CONFIG_COMPAT && defined(CONFIG_X86_64)
 /* just account for different alignment */
-int compat_ioctl_preallocate(struct file *file,
+int compat_ioctl_preallocate(struct file *file, int mode,
 				struct space_resv_32 __user *argp)
 {
 	struct inode *inode = file_inode(file);
@@ -517,7 +517,7 @@ int compat_ioctl_preallocate(struct file *file,
 		return -EINVAL;
 	}
 
-	return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
+	return vfs_fallocate(file, mode | FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
 }
 #endif
 
include/linux/falloc.h +5 -2
index 63c4f0d615bc..ab42b72424f0 100644
@@ -45,10 +45,13 @@ struct space_resv_32 {
 	__s32		l_pad[4];	/* reserve area */
 };
 
-#define FS_IOC_RESVSP_32		_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_RESVSP_32	_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_UNRESVSP_32	_IOW ('X', 41, struct space_resv_32)
 #define FS_IOC_RESVSP64_32	_IOW ('X', 42, struct space_resv_32)
+#define FS_IOC_UNRESVSP64_32	_IOW ('X', 43, struct space_resv_32)
+#define FS_IOC_ZERO_RANGE_32	_IOW ('X', 57, struct space_resv_32)
 
-int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *);
+int compat_ioctl_preallocate(struct file *, int mode, struct space_resv_32 __user *);
 
 #endif
 
Signature · 86 lines
2.23.0

-- 
Cheers,
Stephen Rothwell

diff --cc fs/compat_ioctl.c
index 62e530814cef,9ae90d728c0f..000000000000
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@@ -1020,51 -165,38 +165,57 @@@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned 
  	case FIONBIO:
  	case FIOASYNC:
  	case FIOQSIZE:
- 		break;
- 
- #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
+ 	case FS_IOC_FIEMAP:
+ 	case FIGETBSZ:
+ 	case FICLONERANGE:
+ 	case FIDEDUPERANGE:
+ 		goto found_handler;
+ 	/*
+ 	 * The next group is the stuff handled inside file_ioctl().
+ 	 * For regular files these never reach ->ioctl(); for
+ 	 * devices, sockets, etc. they do and one (FIONREAD) is
+ 	 * even accepted in some cases.  In all those cases
+ 	 * argument has the same type, so we can handle these
+ 	 * here, shunting them towards do_vfs_ioctl().
+ 	 * ->compat_ioctl() will never see any of those.
+ 	 */
+ 	/* pointer argument, never actually handled by ->ioctl() */
+ 	case FIBMAP:
+ 		goto found_handler;
+ 	/* handled by some ->ioctl(); always a pointer to int */
+ 	case FIONREAD:
+ 		goto found_handler;
+ 	/* these two get messy on amd64 due to alignment differences */
+ #if defined(CONFIG_X86_64)
  	case FS_IOC_RESVSP_32:
  	case FS_IOC_RESVSP64_32:
 -		error = compat_ioctl_preallocate(f.file, compat_ptr(arg));
 +		error = compat_ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP_32:
 +	case FS_IOC_UNRESVSP64_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
  		goto out_fput;
  #else
  	case FS_IOC_RESVSP:
  	case FS_IOC_RESVSP64:
 -		goto found_handler;
 +		error = ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP:
 +	case FS_IOC_UNRESVSP64:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
 +		goto out_fput;
  #endif
  
- 	case FICLONE:
- 	case FICLONERANGE:
- 	case FIDEDUPERANGE:
- 	case FS_IOC_FIEMAP:
- 		goto do_ioctl;
- 
- 	case FIBMAP:
- 	case FIGETBSZ:
- 	case FIONREAD:
- 		if (S_ISREG(file_inode(f.file)->i_mode))
- 			break;
- 		/*FALL THROUGH*/
- 
  	default:
  		if (f.file->f_op->compat_ioctl) {
  			error = f.file->f_op->compat_ioctl(f.file, cmd, arg);
#1 lore raw

Hi all,

This conflict is now between the xfs tree and Linus' tree (and the merge fix up patch below needs applying to that merge.

Quoted 163 lines · On Wed, 30 Oct 2019 15:31:10 +1100 Stephen Rothwell <[email protected]>…

Today's linux-next merge of the y2038 tree got a conflict in:

fs/compat_ioctl.c

between commit:

837a6e7f5cdb ("fs: add generic UNRESVSP and ZERO_RANGE ioctl handlers")

from the xfs tree and commits:
011da44bc5b6 ("compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c") 37ecf8b20abd ("compat_sys_ioctl(): make parallel to do_vfs_ioctl()")

from the y2038 tree.

I fixed it up (see below and the added patch) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

From af387ea192196ffd141234e7e45bcfbc2be1a4fc Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email protected]>
Date: Wed, 30 Oct 2019 15:05:29 +1100
Subject: [PATCH] fix up for "compat: move FS_IOC_RESVSP_32 handling to
fs/ioctl.c"

---
 fs/ioctl.c             | 4 ++--
 include/linux/falloc.h | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
fs/ioctl.c +2 -2
index 455ad38c8610..2f5e4e5b97e1 100644
@@ -495,7 +495,7 @@ int ioctl_preallocate(struct file *filp, int mode, void __user *argp)
 /* on ia32 l_start is on a 32-bit boundary */
 #if defined CONFIG_COMPAT && defined(CONFIG_X86_64)
 /* just account for different alignment */
-int compat_ioctl_preallocate(struct file *file,
+int compat_ioctl_preallocate(struct file *file, int mode,
 				struct space_resv_32 __user *argp)
 {
 	struct inode *inode = file_inode(file);
@@ -517,7 +517,7 @@ int compat_ioctl_preallocate(struct file *file,
 		return -EINVAL;
 	}
 
-	return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
+	return vfs_fallocate(file, mode | FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
 }
 #endif
 
include/linux/falloc.h +5 -2
index 63c4f0d615bc..ab42b72424f0 100644
@@ -45,10 +45,13 @@ struct space_resv_32 {
 	__s32		l_pad[4];	/* reserve area */
 };
 
-#define FS_IOC_RESVSP_32		_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_RESVSP_32	_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_UNRESVSP_32	_IOW ('X', 41, struct space_resv_32)
 #define FS_IOC_RESVSP64_32	_IOW ('X', 42, struct space_resv_32)
+#define FS_IOC_UNRESVSP64_32	_IOW ('X', 43, struct space_resv_32)
+#define FS_IOC_ZERO_RANGE_32	_IOW ('X', 57, struct space_resv_32)
 
-int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *);
+int compat_ioctl_preallocate(struct file *, int mode, struct space_resv_32 __user *);
 
 #endif
 
Signature · 5 lines
2.23.0

-- 
Cheers,
Stephen Rothwell
fs/compat_ioctl.c +22 -16
diff --cc fs/compat_ioctl.c
index 62e530814cef,9ae90d728c0f..000000000000
@@@ -1020,51 -165,38 +165,57 @@@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned 
  	case FIONBIO:
  	case FIOASYNC:
  	case FIOQSIZE:
- 		break;
- 
- #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
+ 	case FS_IOC_FIEMAP:
+ 	case FIGETBSZ:
+ 	case FICLONERANGE:
+ 	case FIDEDUPERANGE:
+ 		goto found_handler;
+ 	/*
+ 	 * The next group is the stuff handled inside file_ioctl().
+ 	 * For regular files these never reach ->ioctl(); for
+ 	 * devices, sockets, etc. they do and one (FIONREAD) is
+ 	 * even accepted in some cases.  In all those cases
+ 	 * argument has the same type, so we can handle these
+ 	 * here, shunting them towards do_vfs_ioctl().
+ 	 * ->compat_ioctl() will never see any of those.
+ 	 */
+ 	/* pointer argument, never actually handled by ->ioctl() */
+ 	case FIBMAP:
+ 		goto found_handler;
+ 	/* handled by some ->ioctl(); always a pointer to int */
+ 	case FIONREAD:
+ 		goto found_handler;
+ 	/* these two get messy on amd64 due to alignment differences */
+ #if defined(CONFIG_X86_64)
  	case FS_IOC_RESVSP_32:
  	case FS_IOC_RESVSP64_32:
 -		error = compat_ioctl_preallocate(f.file, compat_ptr(arg));
 +		error = compat_ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP_32:
 +	case FS_IOC_UNRESVSP64_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
  		goto out_fput;
  #else
  	case FS_IOC_RESVSP:
  	case FS_IOC_RESVSP64:
 -		goto found_handler;
 +		error = ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP:
 +	case FS_IOC_UNRESVSP64:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
 +		goto out_fput;
  #endif
 
- 	case FICLONE:
- 	case FICLONERANGE:
- 	case FIDEDUPERANGE:
- 	case FS_IOC_FIEMAP:
- 		goto do_ioctl;
- 
- 	case FIBMAP:
- 	case FIGETBSZ:
- 	case FIONREAD:
- 		if (S_ISREG(file_inode(f.file)->i_mode))
- 			break;
- 		/*FALL THROUGH*/
- 
  	default:
  		if (f.file->f_op->compat_ioctl) {
  			error = f.file->f_op->compat_ioctl(f.file, cmd, arg);
Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw
Quoted 4 lines · Stephen Rothwell

Hi all,

This conflict is now between the xfs tree and Linus' tree (and the merge fix up patch below needs applying to that merge.

There shouldn't be a conflict any more, since Linus just pulled the xfs tree into master and resolved the conflict in the merge commit. (Right? Or am I missing something here post-turkeyweekend? 8))

--D

Quoted 168 lines · On Wed, 30 Oct 2019 15:31:10 +1100 Stephen Rothwell <[email protected]>…
Quoted 163 lines

Today's linux-next merge of the y2038 tree got a conflict in:

fs/compat_ioctl.c

between commit:

837a6e7f5cdb ("fs: add generic UNRESVSP and ZERO_RANGE ioctl handlers")

from the xfs tree and commits:
011da44bc5b6 ("compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c") 37ecf8b20abd ("compat_sys_ioctl(): make parallel to do_vfs_ioctl()")

from the y2038 tree.

I fixed it up (see below and the added patch) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

From af387ea192196ffd141234e7e45bcfbc2be1a4fc Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email protected]>
Date: Wed, 30 Oct 2019 15:05:29 +1100
Subject: [PATCH] fix up for "compat: move FS_IOC_RESVSP_32 handling to
fs/ioctl.c"

---
 fs/ioctl.c             | 4 ++--
 include/linux/falloc.h | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
fs/ioctl.c +2 -2
index 455ad38c8610..2f5e4e5b97e1 100644
@@ -495,7 +495,7 @@ int ioctl_preallocate(struct file *filp, int mode, void __user *argp)
 /* on ia32 l_start is on a 32-bit boundary */
 #if defined CONFIG_COMPAT && defined(CONFIG_X86_64)
 /* just account for different alignment */
-int compat_ioctl_preallocate(struct file *file,
+int compat_ioctl_preallocate(struct file *file, int mode,
 				struct space_resv_32 __user *argp)
 {
 	struct inode *inode = file_inode(file);
@@ -517,7 +517,7 @@ int compat_ioctl_preallocate(struct file *file,
 		return -EINVAL;
 	}
 
-	return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
+	return vfs_fallocate(file, mode | FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
 }
 #endif
 
include/linux/falloc.h +5 -2
index 63c4f0d615bc..ab42b72424f0 100644
@@ -45,10 +45,13 @@ struct space_resv_32 {
 	__s32		l_pad[4];	/* reserve area */
 };
 
-#define FS_IOC_RESVSP_32		_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_RESVSP_32	_IOW ('X', 40, struct space_resv_32)
+#define FS_IOC_UNRESVSP_32	_IOW ('X', 41, struct space_resv_32)
 #define FS_IOC_RESVSP64_32	_IOW ('X', 42, struct space_resv_32)
+#define FS_IOC_UNRESVSP64_32	_IOW ('X', 43, struct space_resv_32)
+#define FS_IOC_ZERO_RANGE_32	_IOW ('X', 57, struct space_resv_32)
 
-int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *);
+int compat_ioctl_preallocate(struct file *, int mode, struct space_resv_32 __user *);
 
 #endif
 
Signature · 5 lines
2.23.0

-- 
Cheers,
Stephen Rothwell
fs/compat_ioctl.c +22 -16
diff --cc fs/compat_ioctl.c
index 62e530814cef,9ae90d728c0f..000000000000
@@@ -1020,51 -165,38 +165,57 @@@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned 
  	case FIONBIO:
  	case FIOASYNC:
  	case FIOQSIZE:
- 		break;
- 
- #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
+ 	case FS_IOC_FIEMAP:
+ 	case FIGETBSZ:
+ 	case FICLONERANGE:
+ 	case FIDEDUPERANGE:
+ 		goto found_handler;
+ 	/*
+ 	 * The next group is the stuff handled inside file_ioctl().
+ 	 * For regular files these never reach ->ioctl(); for
+ 	 * devices, sockets, etc. they do and one (FIONREAD) is
+ 	 * even accepted in some cases.  In all those cases
+ 	 * argument has the same type, so we can handle these
+ 	 * here, shunting them towards do_vfs_ioctl().
+ 	 * ->compat_ioctl() will never see any of those.
+ 	 */
+ 	/* pointer argument, never actually handled by ->ioctl() */
+ 	case FIBMAP:
+ 		goto found_handler;
+ 	/* handled by some ->ioctl(); always a pointer to int */
+ 	case FIONREAD:
+ 		goto found_handler;
+ 	/* these two get messy on amd64 due to alignment differences */
+ #if defined(CONFIG_X86_64)
  	case FS_IOC_RESVSP_32:
  	case FS_IOC_RESVSP64_32:
 -		error = compat_ioctl_preallocate(f.file, compat_ptr(arg));
 +		error = compat_ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP_32:
 +	case FS_IOC_UNRESVSP64_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE_32:
 +		error = compat_ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
  		goto out_fput;
  #else
  	case FS_IOC_RESVSP:
  	case FS_IOC_RESVSP64:
 -		goto found_handler;
 +		error = ioctl_preallocate(f.file, 0, compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_UNRESVSP:
 +	case FS_IOC_UNRESVSP64:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_PUNCH_HOLE,
 +				compat_ptr(arg));
 +		goto out_fput;
 +	case FS_IOC_ZERO_RANGE:
 +		error = ioctl_preallocate(f.file, FALLOC_FL_ZERO_RANGE,
 +				compat_ptr(arg));
 +		goto out_fput;
  #endif
 
- 	case FICLONE:
- 	case FICLONERANGE:
- 	case FIDEDUPERANGE:
- 	case FS_IOC_FIEMAP:
- 		goto do_ioctl;
- 
- 	case FIBMAP:
- 	case FIGETBSZ:
- 	case FIONREAD:
- 		if (S_ISREG(file_inode(f.file)->i_mode))
- 			break;
- 		/*FALL THROUGH*/
- 
  	default:
  		if (f.file->f_op->compat_ioctl) {
  			error = f.file->f_op->compat_ioctl(f.file, cmd, arg);
Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw

Hi Darrick,

Quoted 10 lines · On Mon, 2 Dec 2019 16:22:58 -0800 "Darrick J. Wong" <[email protected]>…
Quoted 4 lines · Stephen Rothwell

Hi all,

This conflict is now between the xfs tree and Linus' tree (and the merge fix up patch below needs applying to that merge.

There shouldn't be a conflict any more, since Linus just pulled the xfs tree into master and resolved the conflict in the merge commit. (Right? Or am I missing something here post-turkeyweekend? 8))

Yeah, it should all be gone in tomorrow's linux-next.

Signature · 2 lines
Cheers,
Stephen Rothwell