linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: prevent signed overflow by using u64 over loff_t
@ 2020-01-13  6:40 Saagar Jha
  2020-01-14  7:54 ` kbuild test robot
  2020-01-16 15:21 ` [PATCH] " kbuild test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Saagar Jha @ 2020-01-13  6:40 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: viro

Hi,

I think I’ve found a signed integer overflow when reconstructing the
64-bit offset from the two 32-bit values syscall arguments, and I believe
the patch below would fix this issue. Unfortunately I don't have in the
way of experience contributing to the kernel, so I would appreciate it if
someone would point out if I should

* not submit this at all,
* submit this somewhere else,
* fix it some other way,
* format this differently,
* test it using some method that I am unaware of,
* or am missing something else in general.

I've tried my best to align with the guidelines but if I've tripped up on
the details I would appreciate guidance on what I should be doing instead.

Thanks,
Saagar Jha

From c3525c7dfb9cede7cc246200ba70455855a3ec8b Mon Sep 17 00:00:00 2001
From: Saagar Jha <saagar@saagarjha.com>
Date: Sun, 12 Jan 2020 21:46:28 -0800
Subject: [PATCH] vfs: prevent signed overflow by using u64 over loff_t

32-bit system calls taking a 64-bit offset that arrive as split over two
32-bit unsigned integers overflow the signed loff_t when shifted over by
32 bits. Using unsigned intermediate types fixes the undefined behavior.

Signed-off-by: Saagar Jha <saagar@saagarjha.com>
---
 fs/read_write.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 5bbf587f5bc1..3a1dfafcaf65 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -347,7 +347,7 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
 	if (whence > SEEK_MAX)
 		goto out_putf;

-	offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low,
+	offset = vfs_llseek(f.file, ((u64) offset_high << 32) | offset_low,
 			whence);

 	retval = (int)offset;
@@ -1250,7 +1250,7 @@ COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = (((u64)pos_high << 32) | pos_low;

 	return do_compat_preadv64(fd, vec, vlen, pos, 0);
 }
@@ -1272,7 +1272,7 @@ COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high,
 		rwf_t, flags)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;

 	if (pos == -1)
 		return do_compat_readv(fd, vec, vlen, flags);
@@ -1359,7 +1359,7 @@ COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;

 	return do_compat_pwritev64(fd, vec, vlen, pos, 0);
 }
@@ -1380,7 +1380,7 @@ COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high, rwf_t, flags)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;

 	if (pos == -1)
 		return do_compat_writev(fd, vec, vlen, flags);
--
2.24.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] vfs: prevent signed overflow by using u64 over loff_t
  2020-01-13  6:40 [PATCH] vfs: prevent signed overflow by using u64 over loff_t Saagar Jha
@ 2020-01-14  7:54 ` kbuild test robot
  2020-01-14  8:28   ` [PATCH v2] " Saagar Jha
  2020-01-16 15:21 ` [PATCH] " kbuild test robot
  1 sibling, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2020-01-14  7:54 UTC (permalink / raw)
  To: Saagar Jha; +Cc: kbuild-all, linux-fsdevel, viro

[-- Attachment #1: Type: text/plain, Size: 29486 bytes --]

Hi Saagar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vfs/for-next]
[also build test ERROR on linus/master v5.5-rc6 next-20200110]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Saagar-Jha/vfs-prevent-signed-overflow-by-using-u64-over-loff_t/20200113-144149
base:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   fs/read_write.c: In function '__do_compat_sys_preadv':
   fs/read_write.c:1253:47: error: expected ')' before ';' token
     loff_t pos = (((u64)pos_high << 32) | pos_low;
                                                  ^
   fs/read_write.c:1256:1: error: expected ',' or ';' before '}' token
    }
    ^
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:78:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
                ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:17:0:
   fs/read_write.c:1271:16: warning: 'alias' attribute ignored [-Wattributes]
      const struct compat_iovec __user *,vec,
                   ^
   include/linux/syscalls.h:117:25: note: in definition of macro '__SC_DECL'
    #define __SC_DECL(t, a) t a
                            ^
   include/linux/syscalls.h:114:35: note: in expansion of macro '__MAP5'
    #define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__)
                                      ^~~~~~
   include/linux/syscalls.h:115:22: note: in expansion of macro '__MAP6'
    #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                         ^~~~~
>> include/linux/compat.h:79:35: note: in expansion of macro '__MAP'
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                                      ^~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:82:21: error: invalid storage class for function '__do_compat_sys_preadv2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compat.h:84:18: error: static declaration of '__se_compat_sys_preadv2' follows non-static declaration
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:83:18: note: previous declaration of '__se_compat_sys_preadv2' was here
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_preadv2':
>> include/linux/compat.h:86:14: error: implicit declaration of function '__do_compat_sys_preadv2'; did you mean '__do_compat_sys_preadv'? [-Werror=implicit-function-declaration]
      long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
                 ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   include/linux/compat.h:91:21: error: invalid storage class for function '__do_compat_sys_preadv2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:91:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1283:15: error: invalid storage class for function 'compat_writev'
    static size_t compat_writev(struct file *file,
                  ^~~~~~~~~~~~~
   fs/read_write.c:1305:15: error: invalid storage class for function 'do_compat_writev'
    static size_t do_compat_writev(compat_ulong_t fd,
                  ^~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:78:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
                ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:17:0:
   fs/read_write.c:1324:16: warning: 'alias' attribute ignored [-Wattributes]
      const struct compat_iovec __user *, vec,
                   ^
   include/linux/syscalls.h:117:25: note: in definition of macro '__SC_DECL'
    #define __SC_DECL(t, a) t a
                            ^
   include/linux/syscalls.h:111:35: note: in expansion of macro '__MAP2'
    #define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
                                      ^~~~~~
   include/linux/syscalls.h:115:22: note: in expansion of macro '__MAP3'
    #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                         ^~~~~
>> include/linux/compat.h:79:35: note: in expansion of macro '__MAP'
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                                      ^~~~~
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:82:21: error: invalid storage class for function '__do_compat_sys_writev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
     ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compat.h:84:18: error: static declaration of '__se_compat_sys_writev' follows non-static declaration
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                     ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:83:18: note: previous declaration of '__se_compat_sys_writev' was here
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                     ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_writev':
>> include/linux/compat.h:86:14: error: implicit declaration of function '__do_compat_sys_writev'; did you mean '__se_compat_sys_writev'? [-Werror=implicit-function-declaration]
      long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
                 ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   include/linux/compat.h:91:21: error: invalid storage class for function '__do_compat_sys_writev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:91:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
     ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1330:13: error: invalid storage class for function 'do_compat_pwritev64'
    static long do_compat_pwritev64(unsigned long fd,
                ^~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:78:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
                ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:17:0:
   fs/read_write.c:1359:16: warning: 'alias' attribute ignored [-Wattributes]
      const struct compat_iovec __user *,vec,
                   ^
   include/linux/syscalls.h:117:25: note: in definition of macro '__SC_DECL'
    #define __SC_DECL(t, a) t a
                            ^
   include/linux/syscalls.h:113:35: note: in expansion of macro '__MAP4'
    #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
                                      ^~~~~~
   include/linux/syscalls.h:115:22: note: in expansion of macro '__MAP5'
    #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                         ^~~~~
>> include/linux/compat.h:79:35: note: in expansion of macro '__MAP'
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                                      ^~~~~
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:82:21: error: invalid storage class for function '__do_compat_sys_pwritev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
     ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compat.h:84:18: error: static declaration of '__se_compat_sys_pwritev' follows non-static declaration
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                     ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:83:18: note: previous declaration of '__se_compat_sys_pwritev' was here
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                     ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_pwritev':
>> include/linux/compat.h:86:14: error: implicit declaration of function '__do_compat_sys_pwritev'; did you mean '__do_compat_sys_writev'? [-Werror=implicit-function-declaration]
      long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
                 ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   include/linux/compat.h:91:21: error: invalid storage class for function '__do_compat_sys_pwritev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:91:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
     ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1358:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compat.h:78:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
                ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:17:0:
   fs/read_write.c:1380:16: warning: 'alias' attribute ignored [-Wattributes]
      const struct compat_iovec __user *,vec,
                   ^
   include/linux/syscalls.h:117:25: note: in definition of macro '__SC_DECL'
    #define __SC_DECL(t, a) t a
                            ^
   include/linux/syscalls.h:114:35: note: in expansion of macro '__MAP5'
    #define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__)
                                      ^~~~~~
   include/linux/syscalls.h:115:22: note: in expansion of macro '__MAP6'
    #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                         ^~~~~
>> include/linux/compat.h:79:35: note: in expansion of macro '__MAP'
     asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                                      ^~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/read_write.c:20:0:
>> include/linux/compat.h:82:21: error: invalid storage class for function '__do_compat_sys_pwritev2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/compat.h:84:18: error: static declaration of '__se_compat_sys_pwritev2' follows non-static declaration
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:83:18: note: previous declaration of '__se_compat_sys_pwritev2' was here
     asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_pwritev2':
>> include/linux/compat.h:86:14: error: implicit declaration of function '__do_compat_sys_pwritev2'; did you mean '__do_compat_sys_pwritev'? [-Werror=implicit-function-declaration]
      long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
                 ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   include/linux/compat.h:91:21: error: invalid storage class for function '__do_compat_sys_pwritev2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:91:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
     ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1379:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1393:16: error: invalid storage class for function 'do_sendfile'
    static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
                   ^~~~~~~~~~~
   fs/read_write.c:1492:1: warning: 'alias' attribute ignored [-Wattributes]
    SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
    ^~~~~~~~~~~~~~~
   In file included from fs/read_write.c:17:0:

vim +/__do_compat_sys_preadv2 +82 include/linux/compat.h

217f4433fc2fe7 Heiko Carstens    2014-02-26  54  
468366138850f2 Al Viro           2012-11-23  55  #define COMPAT_SYSCALL_DEFINE1(name, ...) \
468366138850f2 Al Viro           2012-11-23  56          COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  57  #define COMPAT_SYSCALL_DEFINE2(name, ...) \
468366138850f2 Al Viro           2012-11-23  58  	COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  59  #define COMPAT_SYSCALL_DEFINE3(name, ...) \
468366138850f2 Al Viro           2012-11-23  60  	COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  61  #define COMPAT_SYSCALL_DEFINE4(name, ...) \
468366138850f2 Al Viro           2012-11-23  62  	COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  63  #define COMPAT_SYSCALL_DEFINE5(name, ...) \
468366138850f2 Al Viro           2012-11-23  64  	COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  65  #define COMPAT_SYSCALL_DEFINE6(name, ...) \
468366138850f2 Al Viro           2012-11-23  66  	COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
468366138850f2 Al Viro           2012-11-23  67  
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  68  /*
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  69   * The asmlinkage stub is aliased to a function named __se_compat_sys_*() which
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  70   * sign-extends 32-bit ints to longs whenever needed. The actual work is
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  71   * done within __do_compat_sys_*().
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  72   */
7303e30ec1d8fb Dominik Brodowski 2018-04-05  73  #ifndef COMPAT_SYSCALL_DEFINEx
468366138850f2 Al Viro           2012-11-23  74  #define COMPAT_SYSCALL_DEFINEx(x, name, ...)					\
bee20031772af3 Arnd Bergmann     2018-06-19  75  	__diag_push();								\
bee20031772af3 Arnd Bergmann     2018-06-19  76  	__diag_ignore(GCC, 8, "-Wattribute-alias",				\
bee20031772af3 Arnd Bergmann     2018-06-19  77  		      "Type aliasing is used to sanitize syscall arguments");\
3e2052e5dd4062 Dominik Brodowski 2018-03-22 @78  	asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
83460ec8dcac14 Andi Kleen        2013-11-12 @79  	asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))	\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  80  		__attribute__((alias(__stringify(__se_compat_sys##name))));	\
c9a211951c7c79 Howard McLauchlan 2018-03-21  81  	ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO);				\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @82  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  83  	asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));	\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @84  	asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\
468366138850f2 Al Viro           2012-11-23  85  	{									\
bee20031772af3 Arnd Bergmann     2018-06-19 @86  		long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
bee20031772af3 Arnd Bergmann     2018-06-19  87  		__MAP(x,__SC_TEST,__VA_ARGS__);					\
bee20031772af3 Arnd Bergmann     2018-06-19  88  		return ret;							\
468366138850f2 Al Viro           2012-11-23  89  	}									\
bee20031772af3 Arnd Bergmann     2018-06-19  90  	__diag_pop();								\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  91  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
7303e30ec1d8fb Dominik Brodowski 2018-04-05  92  #endif /* COMPAT_SYSCALL_DEFINEx */
468366138850f2 Al Viro           2012-11-23  93  

:::::: The code at line 82 was first introduced by commit
:::::: 5ac9efa3c50d7caff9f3933bb8a3ad1139d92d92 syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention

:::::: TO: Dominik Brodowski <linux@dominikbrodowski.net>
:::::: CC: Ingo Molnar <mingo@kernel.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25639 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] vfs: prevent signed overflow by using u64 over loff_t
  2020-01-14  7:54 ` kbuild test robot
@ 2020-01-14  8:28   ` Saagar Jha
  0 siblings, 0 replies; 5+ messages in thread
From: Saagar Jha @ 2020-01-14  8:28 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: kbuild-all, viro, kbuild test robot

Oops, I accidentally had accidentally added an extra parenthesis to my
patch; sorry about that. I think I fixed the issue now and I added the
"Reported-by" line to the new patch below. Is there anything else I need
to do?

Regards,
Saagar Jha

From 4867a403decc364c8b0f4cb533bce8419e070e06 Mon Sep 17 00:00:00 2001
From: Saagar Jha <saagar@saagarjha.com>
Date: Sun, 12 Jan 2020 21:46:28 -0800
Subject: [PATCH] vfs: prevent signed overflow by using u64 over loff_t

32-bit system calls taking a 64-bit offset that arrive as split over two
32-bit unsigned integers overflow the signed loff_t when shifted over by
32 bits. Using unsigned intermediate types fixes the undefined behavior.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Saagar Jha <saagar@saagarjha.com>
---
 fs/read_write.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 5bbf587f5bc1..0f40eaa6c315 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -347,7 +347,7 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
 	if (whence > SEEK_MAX)
 		goto out_putf;
 
-	offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low,
+	offset = vfs_llseek(f.file, ((u64) offset_high << 32) | offset_low,
 			whence);
 
 	retval = (int)offset;
@@ -1250,7 +1250,7 @@ COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;
 
 	return do_compat_preadv64(fd, vec, vlen, pos, 0);
 }
@@ -1272,7 +1272,7 @@ COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high,
 		rwf_t, flags)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;
 
 	if (pos == -1)
 		return do_compat_readv(fd, vec, vlen, flags);
@@ -1359,7 +1359,7 @@ COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;
 
 	return do_compat_pwritev64(fd, vec, vlen, pos, 0);
 }
@@ -1380,7 +1380,7 @@ COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
 		const struct compat_iovec __user *,vec,
 		compat_ulong_t, vlen, u32, pos_low, u32, pos_high, rwf_t, flags)
 {
-	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
+	loff_t pos = ((u64)pos_high << 32) | pos_low;
 
 	if (pos == -1)
 		return do_compat_writev(fd, vec, vlen, flags);
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] vfs: prevent signed overflow by using u64 over loff_t
  2020-01-13  6:40 [PATCH] vfs: prevent signed overflow by using u64 over loff_t Saagar Jha
  2020-01-14  7:54 ` kbuild test robot
@ 2020-01-16 15:21 ` kbuild test robot
  2020-01-17  9:58   ` Saagar Jha
  1 sibling, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2020-01-16 15:21 UTC (permalink / raw)
  To: Saagar Jha; +Cc: kbuild-all, linux-fsdevel, viro

[-- Attachment #1: Type: text/plain, Size: 28744 bytes --]

Hi Saagar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vfs/for-next]
[also build test ERROR on linus/master v5.5-rc6 next-20200115]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Saagar-Jha/vfs-prevent-signed-overflow-by-using-u64-over-loff_t/20200113-144149
base:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-next
config: x86_64-randconfig-h001-20200114 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   fs/read_write.c: In function '__do_compat_sys_preadv':
   fs/read_write.c:1253:47: error: expected ')' before ';' token
     loff_t pos = (((u64)pos_high << 32) | pos_low;
                                                  ^
   fs/read_write.c:1256:1: error: expected ',' or ';' before '}' token
    }
    ^
   In file included from include/linux/syscalls.h:96:0,
                    from fs/read_write.c:17:
   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_preadv64v2'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                 ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_preadv64v2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_preadv64v2' follows non-static declaration
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_preadv64v2' was here
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__x32_compat_sys_preadv64v2':
   arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_preadv64v2'; did you mean '__se_compat_sys_preadv64'? [-Werror=implicit-function-declaration]
      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
             ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_preadv64v2'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                 ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_preadv64v2':
   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_preadv64v2'; did you mean '__se_compat_sys_preadv64v2'? [-Werror=implicit-function-declaration]
      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
             ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_preadv64v2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_preadv2'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                 ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_preadv2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_preadv2' follows non-static declaration
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_preadv2' was here
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__x32_compat_sys_preadv2':
   arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_preadv2'; did you mean '__se_compat_sys_preadv'? [-Werror=implicit-function-declaration]
      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
             ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_preadv2'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                 ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_preadv2':
   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_preadv2'; did you mean '__do_compat_sys_preadv'? [-Werror=implicit-function-declaration]
      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
             ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_preadv2'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1283:15: error: invalid storage class for function 'compat_writev'
    static size_t compat_writev(struct file *file,
                  ^~~~~~~~~~~~~
   fs/read_write.c:1305:15: error: invalid storage class for function 'do_compat_writev'
    static size_t do_compat_writev(compat_ulong_t fd,
                  ^~~~~~~~~~~~~~~~
   In file included from include/linux/syscalls.h:96:0,
                    from fs/read_write.c:17:
   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_writev'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                 ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_writev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_writev' follows non-static declaration
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_writev' was here
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__x32_compat_sys_writev':
>> arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_writev'; did you mean '__x32_compat_sys_writev'? [-Werror=implicit-function-declaration]
      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
             ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_writev'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                 ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__se_compat_sys_writev':
   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_writev'; did you mean '__se_compat_sys_writev'? [-Werror=implicit-function-declaration]
      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
             ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__do_compat_sys_preadv':
   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_writev'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
                        ^
   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1330:13: error: invalid storage class for function 'do_compat_pwritev64'
    static long do_compat_pwritev64(unsigned long fd,
                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/syscalls.h:96:0,
                    from fs/read_write.c:17:
   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_pwritev64'
     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
                 ^
   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_pwritev64'
     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
                        ^
   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_pwritev64' follows non-static declaration
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_pwritev64' was here
     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
                     ^
>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
    ^~~~~~~~~~~~~~~~~~~~~~
   fs/read_write.c: In function '__x32_compat_sys_pwritev64':
>> arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_pwritev64'; did you mean '__x32_compat_sys_pwritev64'? [-Werror=implicit-function-declaration]
      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
             ^

vim +/__x32_compat_sys_preadv64v2 +106 arch/x86/include/asm/syscall_wrapper.h

ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   87  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   88  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   89  #ifdef CONFIG_X86_X32
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   90  /*
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   91   * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   92   * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   93   * with x86_64 obviously do not need such care.
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   94   */
cf3b83e19d7c92 Andy Lutomirski   2019-10-08   95  #define __X32_COMPAT_SYS_STUB0(x, name, ...)				\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08   96  	asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs);\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08   97  	ALLOW_ERROR_INJECTION(__x32_compat_sys_##name, ERRNO);		\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08   98  	asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs)\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08   99  	{								\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  100  		return __se_compat_sys_##name();\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  101  	}
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  102  
c76fc98260751e Dominik Brodowski 2018-04-09  103  #define __X32_COMPAT_SYS_STUBx(x, name, ...)				\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  104  	asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  105  	ALLOW_ERROR_INJECTION(__x32_compat_sys##name, ERRNO);		\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @106  	asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  107  	{								\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @108  		return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  109  	}
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  110  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  111  #else /* CONFIG_X86_X32 */
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  112  #define __X32_COMPAT_SYS_STUB0(x, name)
c76fc98260751e Dominik Brodowski 2018-04-09  113  #define __X32_COMPAT_SYS_STUBx(x, name, ...)
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  114  #endif /* CONFIG_X86_X32 */
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  115  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  116  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  117  #ifdef CONFIG_COMPAT
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  118  /*
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  119   * Compat means IA32_EMULATION and/or X86_X32. As they use a different
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  120   * mapping of registers to parameters, we need to generate stubs for each
d5a00528b58cdb Dominik Brodowski 2018-04-09  121   * of them.
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  122   */
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  123  #define COMPAT_SYSCALL_DEFINE0(name)					\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  124  	static long __se_compat_sys_##name(void);			\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  125  	static inline long __do_compat_sys_##name(void);		\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  126  	__IA32_COMPAT_SYS_STUB0(x, name)				\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  127  	__X32_COMPAT_SYS_STUB0(x, name)					\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  128  	static long __se_compat_sys_##name(void)			\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  129  	{								\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  130  		return __do_compat_sys_##name();			\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  131  	}								\
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  132  	static inline long __do_compat_sys_##name(void)
cf3b83e19d7c92 Andy Lutomirski   2019-10-08  133  
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  134  #define COMPAT_SYSCALL_DEFINEx(x, name, ...)					\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  135  	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));	\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  136  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
c76fc98260751e Dominik Brodowski 2018-04-09  137  	__IA32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)				\
c76fc98260751e Dominik Brodowski 2018-04-09 @138  	__X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)				\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  139  	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  140  	{									\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  141  		return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  142  	}									\
5ac9efa3c50d7c Dominik Brodowski 2018-04-09  143  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  144  

:::::: The code at line 106 was first introduced by commit
:::::: 5ac9efa3c50d7caff9f3933bb8a3ad1139d92d92 syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention

:::::: TO: Dominik Brodowski <linux@dominikbrodowski.net>
:::::: CC: Ingo Molnar <mingo@kernel.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38100 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vfs: prevent signed overflow by using u64 over loff_t
  2020-01-16 15:21 ` [PATCH] " kbuild test robot
@ 2020-01-17  9:58   ` Saagar Jha
  0 siblings, 0 replies; 5+ messages in thread
From: Saagar Jha @ 2020-01-17  9:58 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: viro

Hmm, that’s my old patch again :( The new one should build properly, but I don’t know how to tell the bot to use it…

Saagar Jha

> On Jan 16, 2020, at 07:21, kbuild test robot <lkp@intel.com> wrote:
> 
> Hi Saagar,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on vfs/for-next]
> [also build test ERROR on linus/master v5.5-rc6 next-20200115]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Saagar-Jha/vfs-prevent-signed-overflow-by-using-u64-over-loff_t/20200113-144149
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-next
> config: x86_64-randconfig-h001-20200114 (attached as .config)
> compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
> reproduce:
>        # save the attached .config to linux build tree
>        make ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All error/warnings (new ones prefixed by >>):
> 
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   fs/read_write.c:1253:47: error: expected ')' before ';' token
>     loff_t pos = (((u64)pos_high << 32) | pos_low;
>                                                  ^
>   fs/read_write.c:1256:1: error: expected ',' or ';' before '}' token
>    }
>    ^
>   In file included from include/linux/syscalls.h:96:0,
>                    from fs/read_write.c:17:
>   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_preadv64v2'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
>                 ^
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_preadv64v2'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
>                        ^
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_preadv64v2' follows non-static declaration
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_preadv64v2' was here
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__x32_compat_sys_preadv64v2':
>   arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_preadv64v2'; did you mean '__se_compat_sys_preadv64'? [-Werror=implicit-function-declaration]
>      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
>             ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_preadv64v2'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
>                 ^
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__se_compat_sys_preadv64v2':
>   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_preadv64v2'; did you mean '__se_compat_sys_preadv64v2'? [-Werror=implicit-function-declaration]
>      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
>             ^
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_preadv64v2'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>                        ^
>   include/linux/compat.h:64:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1259:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE5'
>    COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_preadv2'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
>                 ^
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_preadv2'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
>                        ^
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_preadv2' follows non-static declaration
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_preadv2' was here
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__x32_compat_sys_preadv2':
>   arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_preadv2'; did you mean '__se_compat_sys_preadv'? [-Werror=implicit-function-declaration]
>      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
>             ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_preadv2'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
>                 ^
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__se_compat_sys_preadv2':
>   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_preadv2'; did you mean '__do_compat_sys_preadv'? [-Werror=implicit-function-declaration]
>      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
>             ^
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_preadv2'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>                        ^
>   include/linux/compat.h:66:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1270:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE6'
>    COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1283:15: error: invalid storage class for function 'compat_writev'
>    static size_t compat_writev(struct file *file,
>                  ^~~~~~~~~~~~~
>   fs/read_write.c:1305:15: error: invalid storage class for function 'do_compat_writev'
>    static size_t do_compat_writev(compat_ulong_t fd,
>                  ^~~~~~~~~~~~~~~~
>   In file included from include/linux/syscalls.h:96:0,
>                    from fs/read_write.c:17:
>   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_writev'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
>                 ^
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_writev'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
>                        ^
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_writev' follows non-static declaration
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_writev' was here
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__x32_compat_sys_writev':
>>> arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_writev'; did you mean '__x32_compat_sys_writev'? [-Werror=implicit-function-declaration]
>      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
>             ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:106:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:139:14: error: invalid storage class for function '__se_compat_sys_writev'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
>                 ^
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__se_compat_sys_writev':
>   arch/x86/include/asm/syscall_wrapper.h:141:10: error: implicit declaration of function '__do_compat_sys_writev'; did you mean '__se_compat_sys_writev'? [-Werror=implicit-function-declaration]
>      return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
>             ^
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__do_compat_sys_preadv':
>   arch/x86/include/asm/syscall_wrapper.h:143:21: error: invalid storage class for function '__do_compat_sys_writev'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>                        ^
>   include/linux/compat.h:60:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1323:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE3'
>    COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1330:13: error: invalid storage class for function 'do_compat_pwritev64'
>    static long do_compat_pwritev64(unsigned long fd,
>                ^~~~~~~~~~~~~~~~~~~
>   In file included from include/linux/syscalls.h:96:0,
>                    from fs/read_write.c:17:
>   arch/x86/include/asm/syscall_wrapper.h:135:14: error: invalid storage class for function '__se_compat_sys_pwritev64'
>     static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
>                 ^
>   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
>    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:136:21: error: invalid storage class for function '__do_compat_sys_pwritev64'
>     static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
>                        ^
>   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
>    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>>> arch/x86/include/asm/syscall_wrapper.h:106:18: error: static declaration of '__x32_compat_sys_pwritev64' follows non-static declaration
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
>    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   arch/x86/include/asm/syscall_wrapper.h:104:18: note: previous declaration of '__x32_compat_sys_pwritev64' was here
>     asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
>                     ^
>>> arch/x86/include/asm/syscall_wrapper.h:138:2: note: in expansion of macro '__X32_COMPAT_SYS_STUBx'
>     __X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)    \
>     ^~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compat.h:62:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
>     COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
>     ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c:1350:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
>    COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
>    ^~~~~~~~~~~~~~~~~~~~~~
>   fs/read_write.c: In function '__x32_compat_sys_pwritev64':
>>> arch/x86/include/asm/syscall_wrapper.h:108:10: error: implicit declaration of function '__se_compat_sys_pwritev64'; did you mean '__x32_compat_sys_pwritev64'? [-Werror=implicit-function-declaration]
>      return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
>             ^
> 
> vim +/__x32_compat_sys_preadv64v2 +106 arch/x86/include/asm/syscall_wrapper.h
> 
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   87  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   88  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   89  #ifdef CONFIG_X86_X32
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   90  /*
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   91   * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   92   * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   93   * with x86_64 obviously do not need such care.
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05   94   */
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08   95  #define __X32_COMPAT_SYS_STUB0(x, name, ...)				\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08   96  	asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs);\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08   97  	ALLOW_ERROR_INJECTION(__x32_compat_sys_##name, ERRNO);		\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08   98  	asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs)\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08   99  	{								\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  100  		return __se_compat_sys_##name();\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  101  	}
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  102  
> c76fc98260751e Dominik Brodowski 2018-04-09  103  #define __X32_COMPAT_SYS_STUBx(x, name, ...)				\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  104  	asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  105  	ALLOW_ERROR_INJECTION(__x32_compat_sys##name, ERRNO);		\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @106  	asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  107  	{								\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09 @108  		return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  109  	}
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  110  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  111  #else /* CONFIG_X86_X32 */
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  112  #define __X32_COMPAT_SYS_STUB0(x, name)
> c76fc98260751e Dominik Brodowski 2018-04-09  113  #define __X32_COMPAT_SYS_STUBx(x, name, ...)
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  114  #endif /* CONFIG_X86_X32 */
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  115  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  116  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  117  #ifdef CONFIG_COMPAT
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  118  /*
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  119   * Compat means IA32_EMULATION and/or X86_X32. As they use a different
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  120   * mapping of registers to parameters, we need to generate stubs for each
> d5a00528b58cdb Dominik Brodowski 2018-04-09  121   * of them.
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  122   */
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  123  #define COMPAT_SYSCALL_DEFINE0(name)					\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  124  	static long __se_compat_sys_##name(void);			\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  125  	static inline long __do_compat_sys_##name(void);		\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  126  	__IA32_COMPAT_SYS_STUB0(x, name)				\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  127  	__X32_COMPAT_SYS_STUB0(x, name)					\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  128  	static long __se_compat_sys_##name(void)			\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  129  	{								\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  130  		return __do_compat_sys_##name();			\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  131  	}								\
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  132  	static inline long __do_compat_sys_##name(void)
> cf3b83e19d7c92 Andy Lutomirski   2019-10-08  133  
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  134  #define COMPAT_SYSCALL_DEFINEx(x, name, ...)					\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  135  	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));	\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  136  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
> c76fc98260751e Dominik Brodowski 2018-04-09  137  	__IA32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)				\
> c76fc98260751e Dominik Brodowski 2018-04-09 @138  	__X32_COMPAT_SYS_STUBx(x, name, __VA_ARGS__)				\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  139  	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  140  	{									\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  141  		return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  142  	}									\
> 5ac9efa3c50d7c Dominik Brodowski 2018-04-09  143  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
> ebeb8c82ffaf94 Dominik Brodowski 2018-04-05  144  
> 
> :::::: The code at line 106 was first introduced by commit
> :::::: 5ac9efa3c50d7caff9f3933bb8a3ad1139d92d92 syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
> 
> :::::: TO: Dominik Brodowski <linux@dominikbrodowski.net>
> :::::: CC: Ingo Molnar <mingo@kernel.org>
> 
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
> <.config.gz>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-17  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  6:40 [PATCH] vfs: prevent signed overflow by using u64 over loff_t Saagar Jha
2020-01-14  7:54 ` kbuild test robot
2020-01-14  8:28   ` [PATCH v2] " Saagar Jha
2020-01-16 15:21 ` [PATCH] " kbuild test robot
2020-01-17  9:58   ` Saagar Jha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).