UML - Redo the signal delivery mechanism
PATCH 1/1 UML - Redo the signal delivery mechanism
This patch rips out the old signal delivery mechanism and replaces it with a sane one.
Specifically, UML used to capture a host signal frame and use it as a template for its own signal frames. This was a worthy idea, because it promised a degree of architecture-independence for this part of UML, but impractical. There are some environments, notably 32 bit emulation on a 64 bit box, where you can't use the host signal frame as a template for your own. Plus, this code is as complicated, even to someone who understands what it's doing, as the standard fill-in-a-structure-and-write-it-to-the-stack. For everyone else, it is incomprehensible.
So, this reimplements signal handling in the way that everyone else does. It gives up on architecture independence, and moves this code into the x86-specific stuff.
arch/um/include/frame.h +0 -53
@@ -1,53 +0,0 @@ -/* -* Copyright (C) 2002 Jeff Dike ([email protected]) -* Licensed under the GPL -*/ - -#ifndef __FRAME_H_ -#define __FRAME_H_ - -#include "sysdep/frame.h" - -struct frame_common { -void *data; -int len; -int sig_index; -int sr_index; -int sr_relative; -int sp_index; -struct arch_frame_data arch; -}; - -struct sc_frame { -struct frame_common common; -int sc_index; -}; - -extern struct sc_frame signal_frame_sc; - -extern struct sc_frame signal_frame_sc_sr; - -struct si_frame { -struct frame_common common; -int sip_index; -int si_index; -int ucp_index; -int uc_index; -}; - -extern struct si_frame signal_frame_si; - -extern void capture_signal_stack (void ); - -#endif - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/include/frame_kern.h +2 -2
@@ -6,8 +6,8 @@#ifndef __FRAME_KERN_H_#define __FRAME_KERN_H_ -#include "frame.h" -#include "sysdep/frame_kern.h" +#define _S (nr) (1<<((nr)-1)) +#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) extern int setup_signal_stack_sc(unsigned long stack_top, int sig, struct k_sigaction *ka,
arch/um/include/frame_user.h +0 -23
@@ -1,23 +0,0 @@ -/* -* Copyright (C) 2002 Jeff Dike ([email protected]) -* Licensed under the GPL -*/ - -#ifndef __FRAME_USER_H_ -#define __FRAME_USER_H_ - -#include "sysdep/frame_user.h" -#include "frame.h" - -#endif - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/include/sysdep-i386/frame.h +0 -29
@@ -1,29 +0,0 @@ -/* -* Copyright (C) 2002 Jeff Dike ([email protected]) -* Licensed under the GPL -*/ - -#ifndef __FRAME_I386_H -#define __FRAME_I386_H - -struct arch_frame_data_raw { -unsigned long fp_start; -unsigned long sr; -}; - -struct arch_frame_data { -int fpstate_size; -}; - -#endif - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/include/sysdep-i386/frame_kern.h +0 -69
69 lines not on this page · raw message
arch/um/include/sysdep-i386/frame_user.h +0 -91
91 lines not on this page · raw message
arch/um/kernel/Makefile +1 -1
@@ -6,7 +6,7 @@ extra-y := vmlinux.lds clean-files := vmlinux.lds.S -obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ +obj-y = checksum.o config.o exec_kern.o exitcode.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \ physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \ sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \
arch/um/kernel/frame.c +0 -343
343 lines not on this page · raw message
arch/um/kernel/frame_kern.c +0 -148
148 lines not on this page · raw message
arch/um/kernel/process_kern.c +0 -2
@@ -291,8 +291,6 @@EXPORT_SYMBOL (disable_hlt); -extern int signal_frame_size; -void *um_kmalloc (int size) {return (kmalloc (size,GFP_KERNEL ));
arch/um/kernel/signal_kern.c +0 -47
53 lines not on this page · raw message
arch/um/kernel/skas/Makefile +0 -1
@@ -5,7 +5,6 @@ obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ syscall_kern.o syscall_user.o time.o tlb.o trap_user.o uaccess.o \ - sys-$(SUBARCH)/ subdir-y := util
arch/um/kernel/skas/include/mode-skas.h +0 -5
@@ -14,11 +14,6 @@extern int have_fpx_regs;extern void user_time_init_skas (void ); -extern int copy_sc_from_user_skas (int pid,union uml_pt_regs *regs, -void *from_ptr); -extern int copy_sc_to_user_skas (int pid,void *to_ptr,void *fp, -union uml_pt_regs *regs, -unsigned long fault_addr,int fault_type);extern void sig_handler_common_skas (int sig,void *sc_ptr);extern void halt_skas (void );extern void reboot_skas (void );
arch/um/kernel/skas/process_kern.c +0 -2
@@ -19,7 +19,6 @@#include "os.h" #include "user_util.h" #include "tlb.h" -#include "frame.h" #include "kern.h" #include "mode.h" #include "proc_mm.h"
@@ -183,7 +182,6 @@int start_uml_skas (void ) {start_userspace (0 ); -capture_signal_stack ();init_new_thread_signals (1 );uml_idle_timer ();
arch/um/kernel/skas/sys-i386/Makefile +0 -12
@@ -1,12 +0,0 @@ -# -# Copyright (C) 2002 Jeff Dike ([email protected]) -# Licensed under the GPL -# - -obj-y = sigcontext.o - -USER_OBJS = sigcontext.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) - -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
arch/um/kernel/skas/sys-i386/sigcontext.c +0 -114
114 lines not on this page · raw message
arch/um/kernel/trap_user.c +0 -1
@@ -18,7 +18,6 @@#include "sigcontext.h" #include "sysdep/sigcontext.h" #include "irq_user.h" -#include "frame_user.h" #include "signal_user.h" #include "time_user.h" #include "task.h"
arch/um/kernel/tt/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-y = exec_kern.o exec_user.o gdb.o ksyms.o mem.o mem_user.o process_kern.o \ syscall_kern.o syscall_user.o time.o tlb.o tracer.o trap_user.o \ - uaccess.o uaccess_user.o sys-$(SUBARCH)/ + uaccess.o uaccess_user.o obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/
arch/um/kernel/tt/include/mode-tt.h +0 -3
@@ -14,9 +14,6 @@extern int tracer (int (*init_proc)(void *),void *sp);extern void user_time_init_tt (void ); -extern int copy_sc_from_user_tt (void *to_ptr,void *from_ptr,void *data); -extern int copy_sc_to_user_tt (void *to_ptr,void *fp,void *from_ptr, -void *data);extern void sig_handler_common_tt (int sig,void *sc);extern void syscall_handler_tt (int sig,union uml_pt_regs *regs);extern void reboot_tt (void );
arch/um/kernel/tt/sys-i386/Makefile +0 -12
@@ -1,12 +0,0 @@ -# -# Copyright (C) 2002 Jeff Dike ([email protected]) -# Licensed under the GPL -# - -obj-y = sigcontext.o - -USER_OBJS = sigcontext.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) - -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
arch/um/kernel/tt/sys-i386/sigcontext.c +0 -60
60 lines not on this page · raw message
arch/um/kernel/tt/tracer.c +0 -2
@@ -25,7 +25,6 @@#include "mem_user.h" #include "process.h" #include "kern_util.h" -#include "frame.h" #include "chan_user.h" #include "ptrace_user.h" #include "mode.h"
@@ -186,7 +185,6 @@int last_index, proc_id =0 , n, err, old_tracing =0 , strace =0 ;int pt_syscall_parm, local_using_sysemu; -capture_signal_stack ();signal (SIGPIPE ,SIG_IGN );setup_tracer_winch (); tracing_pid =os_getpid ();
arch/um/sys-i386/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \ - ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o + ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_MODULES) += module.o
arch/um/sys-i386/sigcontext.c +3 -11
@@ -9,22 +9,14 @@#include <asm/sigcontext.h> #include "sysdep/ptrace.h" #include "kern_util.h" -#include "frame_user.h" - -int sc_size (void *data) -{ -struct arch_frame_data *arch = data; - -return (sizeof (struct sigcontext ) + arch->fpstate_size); -}void sc_to_sc (void *to_ptr,void *from_ptr) {struct sigcontext *to = to_ptr, *from = from_ptr; -int size =sizeof (*to) + signal_frame_sc.common.arch.fpstate_size; -memcpy (to, from, size); -if (from->fpstate !=NULL ) to->fpstate = (struct _fpstate *) (to +1 ); +memcpy (to, from,sizeof (*to) +sizeof (struct _fpstate )); +if (from->fpstate !=NULL ) + to->fpstate = (struct _fpstate *) (to +1 ); }unsigned long *sc_sigmask (void *sc_ptr)
arch/um/sys-i386/signal.c +348 -0
348 lines not on this page · raw message