All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [stable 4.14] turn off -Wattribute-alias
@ 2018-07-26  8:13 Arnd Bergmann
  2018-07-26  8:13   ` Arnd Bergmann
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: stable; +Cc: gregkh, Arnd Bergmann, Michal Marek, linux-kbuild, linux-kernel

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(+)

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)
-- 
2.18.0


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

* [PATCH] [stable 4.4] ARM: fix put_user() for gcc-8
  2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
@ 2018-07-26  8:13   ` Arnd Bergmann
  2018-07-26  8:13 ` [PATCH] [stable 4.4] turn off -Wattribute-alias Arnd Bergmann
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: stable
  Cc: gregkh, Arnd Bergmann, Russell King, linux-arm-kernel, linux-kernel

Building kernels before linux-4.7 with gcc-8 results in many build failures
when gcc triggers a check that was meant to catch broken compilers:

/tmp/ccCGMQmS.s:648: Error: .err encountered

According to the discussion in the gcc bugzilla, a local "register
asm()" variable is still supposed to be the correct way to force an
inline assembly to use a particular register, but marking it 'const'
lets the compiler do optimizations that break that, i.e the compiler is
free to treat the variable as either 'const' or 'register' in that case.

Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code
duplication") fixed this problem in linux-4.8 as part of a larger change,
but seems a little too big to be backported to 4.4.

Let's take the simplest fix and change only the one broken line in the
same way as newer kernels.

Suggested-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85745
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This should also apply to older kernels before 4.4, but I did not try that.
Presumably they have additional problems with modern compilers anyway.

 arch/arm/include/asm/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 35c9db857ebe..cd8b589111ba 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -251,7 +251,7 @@ extern int __put_user_8(void *, unsigned long long);
 	({								\
 		unsigned long __limit = current_thread_info()->addr_limit - 1; \
 		const typeof(*(p)) __user *__tmp_p = (p);		\
-		register const typeof(*(p)) __r2 asm("r2") = (x);	\
+		register typeof(*(p)) __r2 asm("r2") = (x);	\
 		register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \
 		register unsigned long __l asm("r1") = __limit;		\
 		register int __e asm("r0");				\
-- 
2.18.0


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

* [PATCH] [stable 4.4] ARM: fix put_user() for gcc-8
@ 2018-07-26  8:13   ` Arnd Bergmann
  0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

Building kernels before linux-4.7 with gcc-8 results in many build failures
when gcc triggers a check that was meant to catch broken compilers:

/tmp/ccCGMQmS.s:648: Error: .err encountered

According to the discussion in the gcc bugzilla, a local "register
asm()" variable is still supposed to be the correct way to force an
inline assembly to use a particular register, but marking it 'const'
lets the compiler do optimizations that break that, i.e the compiler is
free to treat the variable as either 'const' or 'register' in that case.

Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code
duplication") fixed this problem in linux-4.8 as part of a larger change,
but seems a little too big to be backported to 4.4.

Let's take the simplest fix and change only the one broken line in the
same way as newer kernels.

Suggested-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85745
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This should also apply to older kernels before 4.4, but I did not try that.
Presumably they have additional problems with modern compilers anyway.

 arch/arm/include/asm/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 35c9db857ebe..cd8b589111ba 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -251,7 +251,7 @@ extern int __put_user_8(void *, unsigned long long);
 	({								\
 		unsigned long __limit = current_thread_info()->addr_limit - 1; \
 		const typeof(*(p)) __user *__tmp_p = (p);		\
-		register const typeof(*(p)) __r2 asm("r2") = (x);	\
+		register typeof(*(p)) __r2 asm("r2") = (x);	\
 		register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \
 		register unsigned long __l asm("r1") = __limit;		\
 		register int __e asm("r0");				\
-- 
2.18.0

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

* [PATCH] [stable 4.4] turn off -Wattribute-alias
  2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
  2018-07-26  8:13   ` Arnd Bergmann
@ 2018-07-26  8:13 ` Arnd Bergmann
  2018-07-26  8:13 ` [PATCH 1/2] [stable 4.9] " Arnd Bergmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: stable, Michal Marek
  Cc: gregkh, Arnd Bergmann, Daniel Borkmann, linux-kbuild, linux-kernel

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(+)

diff --git a/Makefile b/Makefile
index 54690fee0485..4812b35df210 100644
--- a/Makefile
+++ b/Makefile
@@ -624,6 +624,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	+= -Os
-- 
2.18.0


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

* [PATCH 1/2] [stable 4.9] turn off -Wattribute-alias
  2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
  2018-07-26  8:13   ` Arnd Bergmann
  2018-07-26  8:13 ` [PATCH] [stable 4.4] turn off -Wattribute-alias Arnd Bergmann
@ 2018-07-26  8:13 ` Arnd Bergmann
  2018-07-26  8:13 ` [PATCH 2/2] [stable-4.9] exec: avoid gcc-8 warning for get_task_comm Arnd Bergmann
  2018-07-26  9:22 ` [PATCH] [stable 4.14] turn off -Wattribute-alias Greg KH
  4 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: stable
  Cc: gregkh, Arnd Bergmann, Michal Marek, Daniel Borkmann,
	linux-kbuild, linux-kernel

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(+)

diff --git a/Makefile b/Makefile
index f4cd42c9b940..41b9954dc0a9 100644
--- a/Makefile
+++ b/Makefile
@@ -635,6 +635,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_LD_DEAD_CODE_DATA_ELIMINATION
 KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
-- 
2.18.0


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

* [PATCH 2/2] [stable-4.9] exec: avoid gcc-8 warning for get_task_comm
  2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
                   ` (2 preceding siblings ...)
  2018-07-26  8:13 ` [PATCH 1/2] [stable 4.9] " Arnd Bergmann
@ 2018-07-26  8:13 ` Arnd Bergmann
  2018-07-26  9:22 ` [PATCH] [stable 4.14] turn off -Wattribute-alias Greg KH
  4 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26  8:13 UTC (permalink / raw)
  To: stable
  Cc: gregkh, Arnd Bergmann, Alexander Viro, Peter Zijlstra,
	Serge Hallyn, James Morris, Aleksa Sarai, Eric W. Biederman,
	Frederic Weisbecker, Thomas Gleixner, Andrew Morton,
	Linus Torvalds

Commit 3756f6401c302617c5e091081ca4d26ab604bec5 upstream.

gcc-8 warns about using strncpy() with the source size as the limit:

  fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]

This is indeed slightly suspicious, as it protects us from source
arguments without NUL-termination, but does not guarantee that the
destination is terminated.

This keeps the strncpy() to ensure we have properly padded target
buffer, but ensures that we use the correct length, by passing the
actual length of the destination buffer as well as adding a build-time
check to ensure it is exactly TASK_COMM_LEN.

There are only 23 callsites which I all reviewed to ensure this is
currently the case.  We could get away with doing only the check or
passing the right length, but it doesn't hurt to do both.

Link: http://lkml.kernel.org/r/20171205151724.1764896-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Kees Cook <keescook@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Aleksa Sarai <asarai@suse.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/exec.c             | 7 +++----
 include/linux/sched.h | 6 +++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index b8c43be24751..fcd8642ef2d2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1228,15 +1228,14 @@ static int de_thread(struct task_struct *tsk)
 	return -EAGAIN;
 }
 
-char *get_task_comm(char *buf, struct task_struct *tsk)
+char *__get_task_comm(char *buf, size_t buf_size, struct task_struct *tsk)
 {
-	/* buf must be at least sizeof(tsk->comm) in size */
 	task_lock(tsk);
-	strncpy(buf, tsk->comm, sizeof(tsk->comm));
+	strncpy(buf, tsk->comm, buf_size);
 	task_unlock(tsk);
 	return buf;
 }
-EXPORT_SYMBOL_GPL(get_task_comm);
+EXPORT_SYMBOL_GPL(__get_task_comm);
 
 /*
  * These functions flushes out all traces of the currently running executable
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5ebef8c86c26..1cc5723a7821 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2999,7 +2999,11 @@ static inline void set_task_comm(struct task_struct *tsk, const char *from)
 {
 	__set_task_comm(tsk, from, false);
 }
-extern char *get_task_comm(char *to, struct task_struct *tsk);
+extern char *__get_task_comm(char *to, size_t len, struct task_struct *tsk);
+#define get_task_comm(buf, tsk) ({			\
+	BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN);	\
+	__get_task_comm(buf, sizeof(buf), tsk);		\
+})
 
 #ifdef CONFIG_SMP
 void scheduler_ipi(void);
-- 
2.18.0

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

* Re: [PATCH] [stable 4.14] turn off -Wattribute-alias
  2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
                   ` (3 preceding siblings ...)
  2018-07-26  8:13 ` [PATCH 2/2] [stable-4.9] exec: avoid gcc-8 warning for get_task_comm Arnd Bergmann
@ 2018-07-26  9:22 ` Greg KH
  2018-07-26 10:02   ` Arnd Bergmann
  4 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2018-07-26  9:22 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: stable, Michal Marek, linux-kbuild, linux-kernel

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

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

* Re: [PATCH] [stable 4.14] turn off -Wattribute-alias
  2018-07-26  9:22 ` [PATCH] [stable 4.14] turn off -Wattribute-alias Greg KH
@ 2018-07-26 10:02   ` Arnd Bergmann
  2018-07-27  9:19     ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2018-07-26 10:02 UTC (permalink / raw)
  To: Greg KH
  Cc: # 3.4.x, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List

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

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

* Re: [PATCH] [stable 4.14] turn off -Wattribute-alias
  2018-07-26 10:02   ` Arnd Bergmann
@ 2018-07-27  9:19     ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2018-07-27  9:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: # 3.4.x, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List

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

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

* Patch "ARM: fix put_user() for gcc-8" has been added to the 3.18-stable tree
  2018-07-26  8:13   ` Arnd Bergmann
  (?)
@ 2018-07-27  9:45   ` gregkh at linuxfoundation.org
  -1 siblings, 0 replies; 11+ messages in thread
From: gregkh at linuxfoundation.org @ 2018-07-27  9:45 UTC (permalink / raw)
  To: linux-arm-kernel


This is a note to let you know that I've just added the patch titled

    ARM: fix put_user() for gcc-8

to the 3.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-fix-put_user-for-gcc-8.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.

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

* Patch "ARM: fix put_user() for gcc-8" has been added to the 4.4-stable tree
  2018-07-26  8:13   ` Arnd Bergmann
  (?)
  (?)
@ 2018-07-27  9:45   ` gregkh at linuxfoundation.org
  -1 siblings, 0 replies; 11+ messages in thread
From: gregkh at linuxfoundation.org @ 2018-07-27  9:45 UTC (permalink / raw)
  To: linux-arm-kernel


This is a note to let you know that I've just added the patch titled

    ARM: fix put_user() for gcc-8

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-fix-put_user-for-gcc-8.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.

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

end of thread, other threads:[~2018-07-27  9:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26  8:13 [PATCH] [stable 4.14] turn off -Wattribute-alias Arnd Bergmann
2018-07-26  8:13 ` [PATCH] [stable 4.4] ARM: fix put_user() for gcc-8 Arnd Bergmann
2018-07-26  8:13   ` Arnd Bergmann
2018-07-27  9:45   ` Patch "ARM: fix put_user() for gcc-8" has been added to the 3.18-stable tree gregkh at linuxfoundation.org
2018-07-27  9:45   ` Patch "ARM: fix put_user() for gcc-8" has been added to the 4.4-stable tree gregkh at linuxfoundation.org
2018-07-26  8:13 ` [PATCH] [stable 4.4] turn off -Wattribute-alias Arnd Bergmann
2018-07-26  8:13 ` [PATCH 1/2] [stable 4.9] " Arnd Bergmann
2018-07-26  8:13 ` [PATCH 2/2] [stable-4.9] exec: avoid gcc-8 warning for get_task_comm Arnd Bergmann
2018-07-26  9:22 ` [PATCH] [stable 4.14] turn off -Wattribute-alias Greg KH
2018-07-26 10:02   ` Arnd Bergmann
2018-07-27  9:19     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.