Skip to contentSkip to conversation

signal.git pile 2

GIT PULL New Al Viro 3 participants 6 messages Dec 21, 2012 – Dec 24, 2012 Generic include/asm header files

lore
Share & tools
lore

Al Viro

author
#0 lore raw

sigaltstack infrastructure + conversion for x86, alpha and um, COMPAT_SYSCALL_DEFINE infrastructure. Note that there are several conflicts between "unify SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline; resolution is trivial - just remove definitions of SS_ONSTACK and SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and include/uapi/linux/signal.h contains the unified variant. Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal for-linus

Shortlog:
Al Viro (11):
COMPAT_SYSCALL_DEFINE: infrastructure
Bury the conditionals from kernel_thread/kernel_execve series missing user_stack_pointer() instances
new helper: current_user_stack_pointer()
unify SS_ONSTACK/SS_DISABLE definitions
new helper: restore_altstack()
new helper: compat_user_stack_pointer()
introduce generic sys_sigaltstack(), switch x86 and um to it generic compat_sys_sigaltstack()
new helpers: __save_altstack/__compat_save_altstack, switch x86 and um to those
alpha: switch to generic sigaltstack

Diffstat:

 arch/Kconfig                             |    9 +--
 arch/alpha/Kconfig                       |    3 +-
 arch/alpha/include/asm/ptrace.h          |    1 +
 arch/alpha/include/asm/signal.h          |    6 --
 arch/alpha/include/asm/unistd.h          |    1 -
 arch/alpha/kernel/signal.c               |   10 +----
 arch/arm/Kconfig                         |    2 -
 arch/arm/include/asm/unistd.h            |    1 -
 arch/arm/include/uapi/asm/signal.h       |    7 ---
 arch/arm64/Kconfig                       |    2 -
 arch/arm64/include/asm/compat.h          |    5 +-
 arch/arm64/include/asm/unistd.h          |    1 -
 arch/avr32/Kconfig                       |    2 -
 arch/avr32/include/asm/ptrace.h          |    1 +
 arch/avr32/include/asm/unistd.h          |    1 -
 arch/avr32/include/uapi/asm/signal.h     |    6 --
 arch/blackfin/Kconfig                    |    2 -
 arch/blackfin/include/asm/ptrace.h       |    1 +
 arch/blackfin/include/asm/unistd.h       |    1 -
 arch/c6x/Kconfig                         |    2 -
 arch/c6x/include/uapi/asm/unistd.h       |    1 -
 arch/cris/Kconfig                        |    2 -
 arch/cris/include/asm/ptrace.h           |    1 +
 arch/cris/include/asm/signal.h           |    6 --
 arch/cris/include/asm/unistd.h           |    1 -
 arch/frv/Kconfig                         |    2 -
 arch/frv/include/asm/unistd.h            |    1 -
 arch/h8300/Kconfig                       |    2 -
 arch/h8300/include/asm/ptrace.h          |    1 +
 arch/h8300/include/asm/signal.h          |    6 --
 arch/h8300/include/asm/unistd.h          |    1 -
 arch/hexagon/Kconfig                     |    2 -
 arch/hexagon/include/uapi/asm/unistd.h   |    1 -
 arch/ia64/Kconfig                        |    2 -
 arch/ia64/include/asm/ptrace.h           |    5 ++
 arch/ia64/include/asm/unistd.h           |    1 -
 arch/ia64/include/uapi/asm/signal.h      |    6 --
 arch/m32r/Kconfig                        |    2 -
 arch/m32r/include/asm/ptrace.h           |    1 +
 arch/m32r/include/asm/signal.h           |    6 --
 arch/m32r/include/asm/unistd.h           |    1 -
 arch/m68k/Kconfig                        |    2 -
 arch/m68k/include/asm/ptrace.h           |    1 +
 arch/m68k/include/asm/unistd.h           |    1 -
 arch/m68k/include/uapi/asm/signal.h      |    6 --
 arch/microblaze/Kconfig                  |    2 -
 arch/microblaze/include/asm/ptrace.h     |    1 +
 arch/microblaze/include/asm/unistd.h     |    1 -
 arch/mips/Kconfig                        |    2 -
 arch/mips/include/asm/ptrace.h           |    1 +
 arch/mips/include/asm/unistd.h           |    1 -
 arch/mips/include/uapi/asm/signal.h      |    6 --
 arch/mn10300/Kconfig                     |    2 -
 arch/mn10300/include/asm/unistd.h        |    1 -
 arch/mn10300/include/uapi/asm/signal.h   |    6 --
 arch/openrisc/Kconfig                    |    2 -
 arch/openrisc/include/uapi/asm/unistd.h  |    1 -
 arch/parisc/Kconfig                      |    2 -
 arch/parisc/include/asm/unistd.h         |    1 -
 arch/parisc/include/uapi/asm/signal.h    |    6 --
 arch/powerpc/Kconfig                     |    2 -
 arch/powerpc/include/asm/unistd.h        |    1 -
 arch/powerpc/include/uapi/asm/signal.h   |    6 --
 arch/s390/Kconfig                        |    2 -
 arch/s390/include/asm/compat.h           |    3 +
 arch/s390/include/asm/unistd.h           |    1 -
 arch/s390/include/uapi/asm/signal.h      |    6 --
 arch/score/Kconfig                       |    2 -
 arch/score/include/asm/ptrace.h          |    1 +
 arch/score/include/asm/unistd.h          |    1 -
 arch/sh/Kconfig                          |    2 -
 arch/sh/include/asm/unistd.h             |    1 -
 arch/sparc/Kconfig                       |    2 -
 arch/sparc/include/asm/unistd.h          |    1 -
 arch/sparc/include/uapi/asm/signal.h     |    6 --
 arch/tile/Kconfig                        |    2 -
 arch/tile/include/asm/ptrace.h           |    1 +
 arch/tile/include/asm/unistd.h           |    1 -
 arch/um/kernel/signal.c                  |    5 --
 arch/unicore32/Kconfig                   |    2 -
 arch/unicore32/include/asm/ptrace.h      |    1 +
 arch/unicore32/include/uapi/asm/unistd.h |    1 -
 arch/x86/Kconfig                         |    3 +-
 arch/x86/ia32/ia32_signal.c              |   55 +---------------------
 arch/x86/ia32/ia32entry.S                |    1 -
 arch/x86/include/asm/ia32.h              |   10 +---
 arch/x86/include/asm/ptrace.h            |    7 +++
 arch/x86/include/asm/signal.h            |    6 --
 arch/x86/include/asm/sys_ia32.h          |    2 -
 arch/x86/include/asm/syscalls.h          |    3 -
 arch/x86/include/asm/unistd.h            |    1 -
 arch/x86/kernel/entry_32.S               |    1 -
 arch/x86/kernel/entry_64.S               |    3 -
 arch/x86/kernel/signal.c                 |   29 ++----------
 arch/x86/syscalls/syscall_32.tbl         |    2 +-
 arch/x86/syscalls/syscall_64.tbl         |    4 +-
 arch/x86/um/Kconfig                      |    3 +-
 arch/x86/um/asm/ptrace.h                 |    1 +
 arch/x86/um/signal.c                     |    9 +---
 arch/x86/um/sys_call_table_32.c          |    1 -
 arch/x86/um/sys_call_table_64.c          |    1 -
 arch/xtensa/Kconfig                      |    2 -
 arch/xtensa/include/asm/ptrace.h         |    2 +
 arch/xtensa/include/asm/unistd.h         |    1 -
 arch/xtensa/include/uapi/asm/signal.h    |    6 --
 fs/exec.c                                |   21 --------
 include/linux/binfmts.h                  |    4 --
 include/linux/compat.h                   |   62 +++++++++++++++++++++++++
 include/linux/ptrace.h                   |    4 ++
 include/linux/sched.h                    |    2 -
 include/linux/signal.h                   |    3 +
 include/linux/syscalls.h                 |   15 ++----
 include/uapi/asm-generic/signal.h        |    6 --
 include/uapi/linux/signal.h              |    2 +
 init/main.c                              |    4 +-
 kernel/fork.c                            |    2 -
 kernel/kmod.c                            |    6 +-
 kernel/signal.c                          |   74 ++++++++++++++++++++++++++++++
 118 files changed, 211 insertions(+), 357 deletions(-)
#1 lore raw

CONFIG_GENERIC_SIGALTSTACK with asm-generic/syscalls.h (was Re: [git pull] signal.git pile 2)

Quoted 9 lines · Al Viro

sigaltstack infrastructure + conversion for x86, alpha and um, COMPAT_SYSCALL_DEFINE infrastructure. Note that there are several conflicts between "unify SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline; resolution is trivial - just remove definitions of SS_ONSTACK and SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and include/uapi/linux/signal.h contains the unified variant. Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal for-linus

Hi Arnd,

In Linus' tree with above merged, selecting CONFIG_GENERIC_SIGALTSTACK is causing build issues for ARC port (and possibly others as well) which use asm-generic/syscalls.h due to a different prototype for sys_sigaltstack coming in from linux/syscalls.h

While I can band-aid ARC port by #define sys_sigaltstack before including asm-generic, it might be better if we conditional-ize one of the prototypes. Following works for me.

include/asm-generic/syscalls.h +2 -0
index 58f466f..1db51b8 100644
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
                        unsigned long fd, off_t pgoff);
 #endif
 
+#ifndef CONFIG_GENERIC_SIGALTSTACK
 #ifndef sys_sigaltstack
 asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
                        struct pt_regs *);
 #endif
+#endif
 
 #ifndef sys_rt_sigreturn
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);

Thx,
-Vineet

author
#2 lore raw

Re: CONFIG_GENERIC_SIGALTSTACK with asm-generic/syscalls.h (was Re: [git pull] signal.git pile 2)

Quoted 13 lines · Vineet Gupta
Quoted 9 lines · Al Viro

sigaltstack infrastructure + conversion for x86, alpha and um, COMPAT_SYSCALL_DEFINE infrastructure. Note that there are several conflicts between "unify SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline; resolution is trivial - just remove definitions of SS_ONSTACK and SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and include/uapi/linux/signal.h contains the unified variant. Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal for-linus

Hi Arnd,

Quoted 8 lines

In Linus' tree with above merged, selecting CONFIG_GENERIC_SIGALTSTACK is causing build issues for ARC port (and possibly others as well) which use asm-generic/syscalls.h due to a different prototype for sys_sigaltstack coming in from linux/syscalls.h

While I can band-aid ARC port by #define sys_sigaltstack before including asm-generic, it might be better if we conditional-ize one of the prototypes. Following works for me.

TBH, the plan was to use such band-aids until all ports using
asm-generic/syscalls.h switch to generic and we drop the damn prototype from there. But yes, what you are suggesting would also do.

As for asm-generic/syscalls.h, it should simply die out. Look:
sys_sigaltstack() eventually goes to linux/syscalls.h, where it ought to be anyway. sys_rt_sigreturn() should be there as well - and it should be long (void); current_pt_regs() is there for purpose... sys_rt_sigsuspend() and and should go into linux/syscalls.h too - the only obstacle is mips and it can simply drop its private implementation and use the generic one. Et cetera...

I hope to kill it completely in the next cycle, along with quite
a few things in arch/*/include/asm/syscalls.h. FWIW, the plan for this cycle signal.git is to put a bunch of generic variants of syscalls into kernel/signal.c (we have a lot of pointless code duplication, mostly in compat ones) and start a bunch of no-rebase arch-$ARCH branches at that point, as it had been done for kernel_thread series - i.e. safely mergable into architecture git trees and going to Linus either that way or through signal.git, preferably the former. sigaltstack(2) definitely should get unified by the end of that, and I hope to get several kilolines of code killed in compat stuff.

Reviewed-by
#3 lore raw

Re: CONFIG_GENERIC_SIGALTSTACK with asm-generic/syscalls.h (was Re: [git pull] signal.git pile 2)

In reply to Vineet Gupta
Quoted 27 lines · Vineet Gupta
Quoted 9 lines · Al Viro

sigaltstack infrastructure + conversion for x86, alpha and um, COMPAT_SYSCALL_DEFINE infrastructure. Note that there are several conflicts between "unify SS_ONSTACK/SS_DISABLE definitions" and UAPI patches in mainline; resolution is trivial - just remove definitions of SS_ONSTACK and SS_DISABLED from arch/*/uapi/asm/signal.h; they are all identical and include/uapi/linux/signal.h contains the unified variant. Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal for-linus

Hi Arnd,

In Linus' tree with above merged, selecting CONFIG_GENERIC_SIGALTSTACK is causing build issues for ARC port (and possibly others as well) which use asm-generic/syscalls.h due to a different prototype for sys_sigaltstack coming in from linux/syscalls.h

While I can band-aid ARC port by #define sys_sigaltstack before including asm-generic, it might be better if we conditional-ize one of the prototypes. Following works for me.

include/asm-generic/syscalls.h +0 -0
index 58f466f..1db51b8 100644

include/asm-generic/syscalls.h asmlinkage long sys_mmap(unsigned long addr, unsigned long len, · line 29

Quoted 9 lines
include/asm-generic/syscalls.h +2 -0
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
                        unsigned long fd, off_t pgoff);
 #endif
 
+#ifndef CONFIG_GENERIC_SIGALTSTACK
 #ifndef sys_sigaltstack
 asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
                        struct pt_regs *);
 #endif
+#endif

I also see this issue with metag when I try and select CONFIG_GENERIC_SIGALTSTACK. Until asm-generic/syscalls.h goes away it seems a shame to have to keep a misleading #define sys_sigaltstack sys_sigaltstack bodge in architecture's asm/syscalls.h.

Cheers
James

author
#4 lore raw

Re: CONFIG_GENERIC_SIGALTSTACK with asm-generic/syscalls.h (was Re: [git pull] signal.git pile 2)

Quoted 6 lines · James Hogan

I also see this issue with metag when I try and select CONFIG_GENERIC_SIGALTSTACK. Until asm-generic/syscalls.h goes away it seems a shame to have to keep a misleading #define sys_sigaltstack sys_sigaltstack bodge in architecture's asm/syscalls.h.

OK, I'm convinced; Vineet, could you reply with Signed-off-by: to use? It's trivial, of course, but...

#5 lore raw

PATCH 1/1 CONFIG_GENERIC_SIGALTSTACK build breakage with asm-generic/syscalls.h

For arches which include asm-generic/syscalls.h as well as newly introduced CONFIG_GENERIC_SIGALTSTACK, there's a build breakage due to conflicting prototypes of sys_sigaltstack(), due to removal of struct pt_regs from latter based code.

----------------------->8-------------------------
In file included from /home/vineetg/arc/upstream-kernel/arch/arc/include/asm/syscalls.h:25,
from arch/arc/kernel/sys.c:6:
include/asm-generic/syscalls.h:26: error: conflicting types for 'sys_sigaltstack'
include/linux/syscalls.h:304: note: previous declaration of 'sys_sigaltstack' was here
make[2]: *** [arch/arc/kernel/sys.o] Error 1 ----------------------->8-------------------------

---
 include/asm-generic/syscalls.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/asm-generic/syscalls.h +2 -0
index 58f466f..1db51b8 100644
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
 			unsigned long fd, off_t pgoff);
 #endif
 
+#ifndef CONFIG_GENERIC_SIGALTSTACK
 #ifndef sys_sigaltstack
 asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
 			struct pt_regs *);
 #endif
+#endif
 
 #ifndef sys_rt_sigreturn
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
Signature · 1 line
1.7.4.1