diff mbox series

[stable,4.14] turn off -Wattribute-alias

Message ID 20180726081358.3829157-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show
Series [stable,4.14] turn off -Wattribute-alias | expand

Commit Message

Arnd Bergmann July 26, 2018, 8:13 a.m. UTC
Starting with gcc-8.1, we get a warning about all system call definitions,
which use an alias between functions with incompatible prototypes, e.g.:

In file included from ../mm/process_vm_access.c:19:
../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)' {aka 'long int(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)'} and 'long int(long int,  long int,  long int,  long int,  long int,  long int)' [-Wattribute-alias]
  asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                  ^~~
../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
  __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^~~~~~~~~~~~~~~~~
../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                    ^~~~~~~~~~~~~~~
../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
 SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
 ^~~~~~~~~~~~~~~
../include/linux/syscalls.h:215:18: note: aliased declaration here
  asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
                  ^~~
../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
  __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^~~~~~~~~~~~~~~~~
../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
 #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
                                    ^~~~~~~~~~~~~~~
../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
 SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,

This is really noisy and does not indicate a real problem. In the latest
mainline kernel, this was addressed by commit bee20031772a ("disable
-Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive
to backport.

This takes a much simpler approach and just disables the warning across the
kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg Kroah-Hartman July 26, 2018, 9:22 a.m. UTC | #1
On Thu, Jul 26, 2018 at 10:13:22AM +0200, Arnd Bergmann wrote:
> Starting with gcc-8.1, we get a warning about all system call definitions,
> which use an alias between functions with incompatible prototypes, e.g.:
> 
> In file included from ../mm/process_vm_access.c:19:
> ../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)' {aka 'long int(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)'} and 'long int(long int,  long int,  long int,  long int,  long int,  long int)' [-Wattribute-alias]
>   asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
>                   ^~~
> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
>   ^~~~~~~~~~~~~~~~~
> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>                                     ^~~~~~~~~~~~~~~
> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
>  ^~~~~~~~~~~~~~~
> ../include/linux/syscalls.h:215:18: note: aliased declaration here
>   asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
>                   ^~~
> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
>   ^~~~~~~~~~~~~~~~~
> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>                                     ^~~~~~~~~~~~~~~
> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
> 
> This is really noisy and does not indicate a real problem. In the latest
> mainline kernel, this was addressed by commit bee20031772a ("disable
> -Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive
> to backport.

Too invasive?

Here's the diffstat:
	 include/linux/compat.h   |    8 +++++++-
	 include/linux/syscalls.h |    4 ++++
	 2 files changed, 11 insertions(+), 1 deletion(-)

That seems almost trivial to backport.  Did you try it and it caused
other problems?

Where ever possible, I always want to use the upstream commits.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann July 26, 2018, 10:02 a.m. UTC | #2
On Thu, Jul 26, 2018 at 11:22 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Thu, Jul 26, 2018 at 10:13:22AM +0200, Arnd Bergmann wrote:
>> Starting with gcc-8.1, we get a warning about all system call definitions,
>> which use an alias between functions with incompatible prototypes, e.g.:
>>
>> In file included from ../mm/process_vm_access.c:19:
>> ../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)' {aka 'long int(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)'} and 'long int(long int,  long int,  long int,  long int,  long int,  long int)' [-Wattribute-alias]
>>   asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
>>                   ^~~
>> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
>>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
>>   ^~~~~~~~~~~~~~~~~
>> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
>>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>>                                     ^~~~~~~~~~~~~~~
>> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
>>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
>>  ^~~~~~~~~~~~~~~
>> ../include/linux/syscalls.h:215:18: note: aliased declaration here
>>   asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
>>                   ^~~
>> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
>>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
>>   ^~~~~~~~~~~~~~~~~
>> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
>>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
>>                                     ^~~~~~~~~~~~~~~
>> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
>>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
>>
>> This is really noisy and does not indicate a real problem. In the latest
>> mainline kernel, this was addressed by commit bee20031772a ("disable
>> -Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive
>> to backport.
>
> Too invasive?
>
> Here's the diffstat:
>          include/linux/compat.h   |    8 +++++++-
>          include/linux/syscalls.h |    4 ++++
>          2 files changed, 11 insertions(+), 1 deletion(-)
>
> That seems almost trivial to backport.  Did you try it and it caused
> other problems?
>
> Where ever possible, I always want to use the upstream commits.

I forward ported that patch a few times across kernels when that macro
changed in subtle ways. This was particularly tricky as some using the
new macro inside of another macro sometimes has different effects
based on seemingly unrelated changes: in particular the addition of
__MAP() in COMPAT_SYSCALL_DEFINEx that I had to do to work
around gcc pr83256 can easily break.

It also depends on commit 8793bb7f4a9d ("kbuild: add macro for
controlling warnings to linux/compiler.h") before it, which is not long
but does add new infrastructure.

      Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman July 27, 2018, 9:19 a.m. UTC | #3
On Thu, Jul 26, 2018 at 12:02:42PM +0200, Arnd Bergmann wrote:
> On Thu, Jul 26, 2018 at 11:22 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Thu, Jul 26, 2018 at 10:13:22AM +0200, Arnd Bergmann wrote:
> >> Starting with gcc-8.1, we get a warning about all system call definitions,
> >> which use an alias between functions with incompatible prototypes, e.g.:
> >>
> >> In file included from ../mm/process_vm_access.c:19:
> >> ../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)' {aka 'long int(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)'} and 'long int(long int,  long int,  long int,  long int,  long int,  long int)' [-Wattribute-alias]
> >>   asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> >>                   ^~~
> >> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> >>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> >>   ^~~~~~~~~~~~~~~~~
> >> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> >>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
> >>                                     ^~~~~~~~~~~~~~~
> >> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
> >>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
> >>  ^~~~~~~~~~~~~~~
> >> ../include/linux/syscalls.h:215:18: note: aliased declaration here
> >>   asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
> >>                   ^~~
> >> ../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> >>   __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> >>   ^~~~~~~~~~~~~~~~~
> >> ../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> >>  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
> >>                                     ^~~~~~~~~~~~~~~
> >> ../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
> >>  SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
> >>
> >> This is really noisy and does not indicate a real problem. In the latest
> >> mainline kernel, this was addressed by commit bee20031772a ("disable
> >> -Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive
> >> to backport.
> >
> > Too invasive?
> >
> > Here's the diffstat:
> >          include/linux/compat.h   |    8 +++++++-
> >          include/linux/syscalls.h |    4 ++++
> >          2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > That seems almost trivial to backport.  Did you try it and it caused
> > other problems?
> >
> > Where ever possible, I always want to use the upstream commits.
> 
> I forward ported that patch a few times across kernels when that macro
> changed in subtle ways. This was particularly tricky as some using the
> new macro inside of another macro sometimes has different effects
> based on seemingly unrelated changes: in particular the addition of
> __MAP() in COMPAT_SYSCALL_DEFINEx that I had to do to work
> around gcc pr83256 can easily break.
> 
> It also depends on commit 8793bb7f4a9d ("kbuild: add macro for
> controlling warnings to linux/compiler.h") before it, which is not long
> but does add new infrastructure.

Ah, yeah, that's a mess.  Ok, I'll go queue these up, thanks.  Maybe I
can finally move to gcc-8 now :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a44d6b2adb76..91f9d2d56eac 100644
--- a/Makefile
+++ b/Makefile
@@ -642,6 +642,7 @@  KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
+KBUILD_CFLAGS	+= $(call cc-disable-warning, attribute-alias)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= $(call cc-option,-Oz,-Os)