Subject: linux-next: build failure after merge of the vfs tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 28 Sep 2020 11:31:42 +1000

Hi all,

After merging the vfs tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from arch/arm/include/asm/atomic.h:11,
                 from include/linux/atomic.h:7,
                 from include/linux/crypto.h:15,
                 from include/crypto/hash.h:11,
                 from lib/iov_iter.c:2:
lib/iov_iter.c: In function 'copy_compat_iovec_from_user':
lib/iov_iter.c:1665:29: error: invalid use of undefined type 'struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1665:32: error: invalid use of undefined type 'const struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1665:29: error: invalid use of undefined type 'struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1665:32: error: invalid use of undefined type 'const struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1665:29: error: invalid use of undefined type 'struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1665:32: error: invalid use of undefined type 'const struct compat_iovec'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1665:3: note: in expansion of macro 'unsafe_get_user'
 1665 |   unsafe_get_user(len, &uiov[i].iov_len, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:29: error: invalid use of undefined type 'struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:32: error: invalid use of undefined type 'const struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:29: error: invalid use of undefined type 'struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:32: error: invalid use of undefined type 'const struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:29: error: invalid use of undefined type 'struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                             ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~
lib/iov_iter.c:1666:32: error: invalid use of undefined type 'const struct compat_iovec'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |                                ^
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
   78 | # define unlikely(x) __builtin_expect(!!(x), 0)
      |                                          ^
include/linux/uaccess.h:370:32: note: in expansion of macro 'unsafe_op_wrap'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                ^~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:238:3: note: in expansion of macro '__get_user_check'
  238 |   __get_user_check(x, p);     \
      |   ^~~~~~~~~~~~~~~~
arch/arm/include/asm/uaccess.h:296:28: note: in expansion of macro 'get_user'
  296 | #define __get_user(x, ptr) get_user(x, ptr)
      |                            ^~~~~~~~
include/linux/uaccess.h:370:47: note: in expansion of macro '__get_user'
  370 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e)
      |                                               ^~~~~~~~~~
lib/iov_iter.c:1666:3: note: in expansion of macro 'unsafe_get_user'
 1666 |   unsafe_get_user(buf, &uiov[i].iov_base, uaccess_end);
      |   ^~~~~~~~~~~~~~~

Caused by commit

  99dc3a9dd6ca ("iov_iter: refactor rw_copy_check_uvector and import_iovec")

CONFIG_COMAPT is not set for this build ...

I have added the following hack patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Mon, 28 Sep 2020 11:25:57 +1000
Subject: [PATCH] iov_iter: fix build when CONFIG_COMPAT is not set

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 lib/iov_iter.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 8a8e25f8e3e8..5892f4c40291 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1648,6 +1648,7 @@ const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags)
 }
 EXPORT_SYMBOL(dup_iter);
 
+#ifdef CONFIG_COMPAT
 static int copy_compat_iovec_from_user(struct iovec *iov,
 		const struct iovec __user *uvec, unsigned long nr_segs)
 {
@@ -1679,7 +1680,8 @@ static int copy_compat_iovec_from_user(struct iovec *iov,
 	user_access_end();
 	return ret;
 }
-		
+#endif /* CONFIG_COMPAT */
+
 static int copy_iovec_from_user(struct iovec *iov,
 		const struct iovec __user *uvec, unsigned long nr_segs)
 {
@@ -1717,9 +1719,11 @@ struct iovec *iovec_from_user(const struct iovec __user *uvec,
 			return ERR_PTR(-ENOMEM);
 	}
 
+#ifdef CONFIG_COMPAT
 	if (compat)
 		ret = copy_compat_iovec_from_user(iov, uvec, nr_segs);
 	else
+#endif
 		ret = copy_iovec_from_user(iov, uvec, nr_segs);
 	if (ret) {
 		if (iov != fast_iov)
-- 
2.28.0

-- 
Cheers,
Stephen Rothwell