diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2018-06-19 16:14:57 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-06-25 10:21:13 -0400 |
| commit | bee20031772af3debe8cbaa234528f24c7892e8f (patch) | |
| tree | 89dda7f20d8320f1c93f20d2adae124c3133cff7 /include/linux/compat.h | |
| parent | 8793bb7f4a9dd1396575d2e9337d331662cb7555 (diff) | |
disable -Wattribute-alias warning for SYSCALL_DEFINEx()
gcc-8 warns for every single definition of a system call entry
point, e.g.:
include/linux/compat.h:56:18: error: 'compat_sys_rt_sigprocmask' alias between functions of incompatible types 'long int(int, compat_sigset_t *, compat_sigset_t *, compat_size_t)' {aka 'long int(int, struct <anonymous> *, struct <anonymous> *, unsigned int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias]
asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
^~~~~~~~~~
include/linux/compat.h:45:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~
kernel/signal.c:2601:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
^~~~~~~~~~~~~~~~~~~~~~
include/linux/compat.h:60:18: note: aliased declaration here
asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
^~~~~~~~~~
The new warning seems reasonable in principle, but it doesn't
help us here, since we rely on the type mismatch to sanitize the
system call arguments. After I reported this as GCC PR82435, a new
-Wno-attribute-alias option was added that could be used to turn the
warning off globally on the command line, but I'd prefer to do it a
little more fine-grained.
Interestingly, turning a warning off and on again inside of
a single macro doesn't always work, in this case I had to add
an extra statement inbetween and decided to copy the __SC_TEST
one from the native syscall to the compat syscall macro. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 for more details
about this.
[paul.burton@mips.com:
- Rebase atop current master.
- Split GCC & version arguments to __diag_ignore() in order to match
changes to the preceding patch.
- Add the comment argument to match the preceding patch.]
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'include/linux/compat.h')
| -rw-r--r-- | include/linux/compat.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index b1a5562b3215..c68acc47da57 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -72,6 +72,9 @@ | |||
| 72 | */ | 72 | */ |
| 73 | #ifndef COMPAT_SYSCALL_DEFINEx | 73 | #ifndef COMPAT_SYSCALL_DEFINEx |
| 74 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | 74 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ |
| 75 | __diag_push(); \ | ||
| 76 | __diag_ignore(GCC, 8, "-Wattribute-alias", \ | ||
| 77 | "Type aliasing is used to sanitize syscall arguments");\ | ||
| 75 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ | 78 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
| 76 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ | 79 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ |
| 77 | __attribute__((alias(__stringify(__se_compat_sys##name)))); \ | 80 | __attribute__((alias(__stringify(__se_compat_sys##name)))); \ |
| @@ -80,8 +83,11 @@ | |||
| 80 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ | 83 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ |
| 81 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ | 84 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ |
| 82 | { \ | 85 | { \ |
| 83 | return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ | 86 | long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ |
| 87 | __MAP(x,__SC_TEST,__VA_ARGS__); \ | ||
| 88 | return ret; \ | ||
| 84 | } \ | 89 | } \ |
| 90 | __diag_pop(); \ | ||
| 85 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) | 91 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
| 86 | #endif /* COMPAT_SYSCALL_DEFINEx */ | 92 | #endif /* COMPAT_SYSCALL_DEFINEx */ |
| 87 | 93 | ||
