summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/signal_64.c
Commit message (Collapse)AuthorAgeFilesLines
* x86/signal/compat: Move sigaction_compat_abi() to signal_64.cBrian Gerst2023-01-061-0/+13
| | | | | | | | | Also remove the now-empty signal_compat.c. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20221219193904.190220-3-brgerst@gmail.com Cc: Al Viro <viro@zeniv.linux.org.uk>
* x86/signal: Move siginfo field testsBrian Gerst2023-01-061-0/+114
| | | | | | | | | | | | Move the tests to the appropriate signal_$(BITS).c file. Convert them to use static_assert(), removing the need for a dummy function. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20221219193904.190220-2-brgerst@gmail.com Cc: Al Viro <viro@zeniv.linux.org.uk>
* x86/signal/64: Move 64-bit signal code to its own fileBrian Gerst2022-10-191-0/+383
| | | | | | | | | | [ bp: Fixup merge conflict caused by changes coming from the kbuild tree. ] Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Link: https://lore.kernel.org/r/20220606203802.158958-9-brgerst@gmail.com Signed-off-by: Borislav Petkov <bp@suse.de>
* x86: signal: unify signal_{32|64}.cHiroshi Shimamoto2008-11-261-915/+0
| | | | | | | | | | Impact: cleanup Unify signal_{32|64}.c! Mechanic unification - the two files are the same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: unify signal_{32|64}.c, prepareHiroshi Shimamoto2008-11-261-1/+115
| | | | | | | | | Impact: cleanup Add #ifdef directive for 32-bit only code. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of __setup_sigframe() and ↵Hiroshi Shimamoto2008-11-261-53/+256
| | | | | | | | | | | | __setup_rt_sigframe() Impact: cleanup Add #ifdef directive to unify __setup_sigframe() and __setup_rt_sigframe(). Move them after {setup|restore}_sigcontext() declaration. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: move {setup|restore}_sigcontext()Hiroshi Shimamoto2008-11-261-74/+74
| | | | | | | | | Impact: cleanup Move {setup|restore}_sigcontext() declaration onto head of file. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of sys_rt_sigreturn()Hiroshi Shimamoto2008-11-231-0/+9
| | | | | | | | | Impact: cleanup Add #ifdef directive for unification. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of sys_sigaltstack()Hiroshi Shimamoto2008-11-231-0/+15
| | | | | | | | | Impact: cleanup Add #ifdef directive for unification. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of including headersHiroshi Shimamoto2008-11-231-1/+6
| | | | | | | | | Impact: cleanup Make the headers portion of signal_32.c and signal_64.c the same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: rename COPY_SEG_STRICT to COPY_SEG_CPL3Hiroshi Shimamoto2008-11-211-4/+4
| | | | | | | | | Impact: cleanup Rename macro COPY_SEG_STRICT to COPY_SEG_CPL3, as suggested by hpa. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of setup_sigcontext()Hiroshi Shimamoto2008-11-081-5/+28
| | | | | | | | | Impact: cleanup Make setup_sigcontext() same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64: make setup_sigcontext() similarHiroshi Shimamoto2008-11-061-7/+5
| | | | | | | | | Impact: cleanup remove passing task struct. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64: setup fpstate in setup_sigcontext()Hiroshi Shimamoto2008-11-061-4/+6
| | | | | | | | | Impact: cleanup set fpstate field of signal context at setup_sigcontext(). Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64: remove unused code in __setup_rt_frame()Hiroshi Shimamoto2008-11-041-5/+1
| | | | | | | | | Impact: cleanup sizeof(*set) is always 8 on x86_64. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of NR_restart_syscallHiroshi Shimamoto2008-10-301-0/+5
| | | | | | | | | Impact: cleanup Add #ifdef directive to unify NR_restart_syscall. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of macros for setup_rt_frame()Hiroshi Shimamoto2008-10-301-2/+12
| | | | | | | | | Impact: cleanup Add #ifdef directive for unification. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of signr_convert()Hiroshi Shimamoto2008-10-301-0/+6
| | | | | | | | | Impact: cleanup Make signr_convert() same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64.c: get_stack() doesn't need entire regsHiroshi Shimamoto2008-10-271-6/+4
| | | | | | | | | Impact: cleanup get_stack() uses sp only, entire regs is not needed. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of restore_sigcontext()Hiroshi Shimamoto2008-10-271-0/+15
| | | | | | | | | Impact: cleanup Make restore_sigcontext() the same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: remove indent in restore_sigcontext()Hiroshi Shimamoto2008-10-031-12/+7
| | | | | | | remove braces and indent for flags and fpstate in restore_sigcontext(). Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: move macros out from restore_sigcontext()Hiroshi Shimamoto2008-10-031-7/+11
| | | | | | | | move macros, COPY, COPY_SEG*, GET_SEG, out from restore_sigcontext(). x86_64: introduce COPY_SEG_STRICT for cs. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: introduce helper macro is_ia32Hiroshi Shimamoto2008-09-251-4/+9
| | | | | | | | Introduce new macro is_ia32 for unification of setup_rt_frame(). No effect in binary, compiler will optimize. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64.c: introduce helper function signr_convert()Hiroshi Shimamoto2008-09-251-2/+8
| | | | | | | | This helper function is for unification of setup_rt_frame(). No effect in binary. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of handle_signal()Hiroshi Shimamoto2008-09-241-0/+2
| | | | | | | Make handle_signal() same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of do_notify_resume()Hiroshi Shimamoto2008-09-241-4/+12
| | | | | | | Make do_notify_resume() same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: cosmetic unification of do_signal()Hiroshi Shimamoto2008-09-241-2/+4
| | | | | | | | Make do_signal() same. Thia patch modifies only comments in signal_64.c. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: introduce do_rt_sigreturn()Hiroshi Shimamoto2008-09-141-3/+8
| | | | | | | | | introduce do_rt_sigreturn(), to collect common part of sys_rt_sigreturn(). No change in functionality intended. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: remove unneeded err handlingHiroshi Shimamoto2008-09-141-3/+2
| | | | | | | This patch eliminates unused or unneeded variable handling. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: put give_sigsegv of setup frames togetherHiroshi Shimamoto2008-09-141-8/+9
| | | | | | | | | | | | | When setup frame fails, force_sigsegv is called and returns -EFAULT. There is similar code in ia32_setup_frame(), ia32_setup_rt_frame(), __setup_frame() and __setup_rt_frame(). Make them identical. No change in functionality intended. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64.c: make handle_signal() similarHiroshi Shimamoto2008-09-101-28/+29
| | | | | | | | | Make handle_signal() same as 32bit. No change in functionality intended. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64.c: arg for restore_i387_xstate() is void __user *Hiroshi Shimamoto2008-09-101-1/+2
| | | | | | | | | | | restore_i387_xstate() is declared as: int restore_i387_xstate(void __user *buf); so, make the variable buf void __user *. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal_64.c: clean up signal_fault()Hiroshi Shimamoto2008-09-101-4/+6
| | | | | | | clean up and make signal_fault() same as 32bit. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: split out frame setupsHiroshi Shimamoto2008-09-061-10/+20
| | | | | | | | Make setup_rt_frame() and split out frame setups from handle_signal(). This is for cosmetic unification of handle_signal(). Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* x86: signal: make NR_restart_syscallHiroshi Shimamoto2008-09-061-3/+3
| | | | | | | make NR_restart_syscall macro for cosmetic unification of handle_signal(). Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* Merge branch 'x86/cleanups' into x86/signalIngo Molnar2008-09-061-29/+27
|\ | | | | | | | | | | | | Conflicts: arch/x86/kernel/signal_64.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * Merge branch 'linus' into x86/cleanupsIngo Molnar2008-08-201-1/+10
| |\
| * | x86: coding style fixes to arch/x86/kernel/signal_64.cGustavo F. Padovan2008-07-311-32/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix all errors and many warnings reported by checkpatch.pl without change signal_64.o arch/x86/kernel/signal_64.o text data bss dec hex filename 5143 0 8 5151 141f signal_64.o.after 5143 0 8 5151 141f signal_64.o.before md5: e68718092b3641cb27e79e55ce57e3ad signal_64.o.after e68718092b3641cb27e79e55ce57e3ad signal_64.o.before Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br> Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | |
| \ \
| \ \
| \ \
*---. \ \ Merge branches 'x86/tracehook', 'x86/xsave' and 'x86/prototypes' into x86/signalIngo Molnar2008-09-061-121/+24
|\ \ \ \ \ | |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | Conflicts: arch/x86/kernel/signal_64.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | | * | Merge commit 'v2.6.27-rc3' into x86/prototypesIngo Molnar2008-08-141-3/+53
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: include/asm-x86/dma-mapping.h Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | | * | x86: Introducing asm/syscalls.hJaswinder Singh2008-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Declaring arch-dependent syscalls for x86 architecture Signed-off-by: Jaswinder Singh <jaswinder@infradead.org>
| | * | | x86, xsave: remove the redundant access_ok() in setup_rt_frame()Suresh Siddha2008-08-141-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | save_i387_xstate() is already doing the required access_ok(). Remove the redundant access_ok() before it. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * | | x86, xsave: save/restore the extended state context in sigframeSuresh Siddha2008-07-301-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On cpu's supporting xsave/xrstor, fpstate pointer in the sigcontext, will include the extended state information along with fpstate information. Presence of extended state information is indicated by the presence of FP_XSTATE_MAGIC1 at fpstate.sw_reserved.magic1 and FP_XSTATE_MAGIC2 at fpstate + (fpstate.sw_reserved.extended_size - FP_XSTATE_MAGIC2_SIZE). Extended feature bit mask that is saved in the memory layout is represented by the fpstate.sw_reserved.xstate_bv For RT signal frames, UC_FP_XSTATE in the uc_flags also indicate the presence of extended state information in the sigcontext's fpstate pointer. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * | | x86, xsave: reorganization of signal save/restore fpstate code layoutSuresh Siddha2008-07-301-80/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | move 64bit routines that saves/restores fpstate in/from user stack from signal_64.c to xsave.c restore_i387_xstate() now handles the condition when user passes NULL fpstate. Other misc changes for prepartion of xsave/xrstor sigcontext support. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * | | x86, xsave: dynamically allocate sigframes fpstate instead of static allocationSuresh Siddha2008-07-301-1/+1
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dynamically allocate fpstate on the stack, instead of static allocation in the current sigframe layout on the user stack. This will allow the fpstate structure to grow in the future, which includes extended state information supporting xsave/xrstor. signal handlers will be able to access the fpstate pointer from the sigcontext structure asusual, with no change. For the non RT sigframe's (which are supported only for 32bit apps), current static fpstate layout in the sigframe will be unused(so that we don't change the extramask[] offset in the sigframe and thus prevent breaking app's which modify extramask[]). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * | | Merge branch 'linus' into x86/tracehookIngo Molnar2008-09-051-1/+10
| |\ \ \ | |/ / / |/| | |
| * | | x86: tracehook: TIF_NOTIFY_RESUMERoland McGrath2008-07-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds TIF_NOTIFY_RESUME support for x86, both 64-bit and 32-bit. When set, we call tracehook_notify_resume() on the way to user mode. Signed-off-by: Roland McGrath <roland@redhat.com>
| * | | x86 signals: use asm/syscall.hRoland McGrath2008-07-261-33/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace local inlines with the asm/syscall.h interfaces that do the same things. Signed-off-by: Roland McGrath <roland@redhat.com>
| * | | x86: tracehook_signal_handlerRoland McGrath2008-07-261-2/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | This makes the x86 signal handling code use tracehook_signal_handler() in place of calling into ptrace guts. The call is moved after the sa_mask processing, but there is no other change. This cleanup doesn't matter to existing debuggers, but is the sensible thing: have all facets of the handler setup complete before the debugger inspects the task again. Signed-off-by: Roland McGrath <roland@redhat.com>
* / | x64, fpu: fix possible FPU leakage in error conditionsSuresh Siddha2008-07-261-1/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Thu, Jul 24, 2008 at 03:43:44PM -0700, Linus Torvalds wrote: > So how about this patch as a starting point? This is the RightThing(tm) to > do regardless, and if it then makes it easier to do some other cleanups, > we should do it first. What do you think? restore_fpu_checking() calls init_fpu() in error conditions. While this is wrong(as our main intention is to clear the fpu state of the thread), this was benign before commit 92d140e21f1 ("x86: fix taking DNA during 64bit sigreturn"). Post commit 92d140e21f1, live FPU registers may not belong to this process at this error scenario. In the error condition for restore_fpu_checking() (especially during the 64bit signal return), we are doing init_fpu(), which saves the live FPU register state (possibly belonging to some other process context) into the thread struct (through unlazy_fpu() in init_fpu()). This is wrong and can leak the FPU data. For the signal handler restore error condition in restore_i387(), clear the fpu state present in the thread struct(before ultimately sending a SIGSEGV for badframe). For the paranoid error condition check in math_state_restore(), send a SIGSEGV, if we fail to restore the state. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: <stable@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>