linux/arch/alpha/kernel
Al Viro 494486a1d2 alpha: deal with multiple simultaneously pending signals
Unlike the other targets, alpha sets _one_ sigframe and
buggers off until the next syscall/interrupt, even if
more signals are pending.  It leads to quite a few unpleasant
inconsistencies, starting with SIGSEGV potentially arriving
not where it should and including e.g. mess with sigsuspend();
consider two pending signals blocked until sigsuspend()
unblocks them.  We pick the first one; then, if we are hit
by interrupt while in the handler, we process the second one
as well.  If we are not, and if no syscalls had been made,
we get out of the first handler and leave the second signal
pending; normally sigreturn() would've picked it anyway, but
here it starts with restoring the original mask and voila -
the second signal is blocked again.  On everything else we
get both delivered consistently.

It's actually easy to fix; the only thing to watch out for
is prevention of double syscall restart.  Fortunately, the
idea I've nicked from arm fix by rmk works just fine...

Testcase demonstrating the behaviour in question; on alpha
we get one or both flags set (usually one), on everything
else both are always set.
	#include <signal.h>
	#include <stdio.h>
	int had1, had2;
	void f1(int sig) { had1 = 1; }
	void f2(int sig) { had2 = 1; }
	main()
	{
		sigset_t set1, set2;
		sigemptyset(&set1);
		sigemptyset(&set2);
		sigaddset(&set2, 1);
		sigaddset(&set2, 2);
		signal(1, f1);
		signal(2, f2);
		sigprocmask(SIG_SETMASK, &set2, NULL);
		raise(1);
		raise(2);
		sigsuspend(&set1);
		printf("had1:%d had2:%d\n", had1, had2);
	}

Tested-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2010-09-18 23:08:29 -04:00
..
.gitignore alpha: .gitignore vmlinux.lds 2009-01-15 16:39:40 -08:00
alpha_ksyms.c Generic semaphore implementation 2008-04-17 10:42:34 -04:00
asm-offsets.c CRED: Separate task security context from task_struct 2008-11-14 10:39:16 +11:00
binfmt_loader.c alpha: binfmt_aout fix 2009-05-02 15:36:10 -07:00
console.c ALPHA: support graphics on non-zero PCI domains 2007-06-01 08:18:29 -07:00
core_apecs.c [PATCH] alpha pt_regs cleanups: machine_check() 2006-10-08 12:32:36 -07:00
core_cia.c [PATCH] alpha pt_regs cleanups: machine_check() 2006-10-08 12:32:36 -07:00
core_irongate.c Introduce flags for reserve_bootmem() 2008-02-07 08:42:25 -08:00
core_lca.c [PATCH] alpha pt_regs cleanups: machine_check() 2006-10-08 12:32:36 -07:00
core_marvel.c arch/alpha/kernel: Add kmalloc NULL tests 2009-11-30 15:38:19 -05:00
core_mcpcia.c alpha: fixes for specific machine types 2007-04-17 16:36:27 -07:00
core_polaris.c [PATCH] alpha pt_regs cleanups: machine_check() 2006-10-08 12:32:36 -07:00
core_t2.c alpha: Fix fallout from locking changes 2009-12-14 23:55:32 +01:00
core_titan.c arch/alpha/kernel: Add kmalloc NULL tests 2009-11-30 15:38:19 -05:00
core_tsunami.c alpha: remove remaining __FUNCTION__ occurrences 2008-04-28 08:58:27 -07:00
core_wildfire.c [PATCH] alpha pt_regs cleanups: machine_check() 2006-10-08 12:32:36 -07:00
entry.S alpha: deal with multiple simultaneously pending signals 2010-09-18 23:08:29 -04:00
err_common.c PCI: Cleanup the includes of <linux/pci.h> 2007-05-02 19:02:35 -07:00
err_ev6.c alpha: Use static const char * const where possible 2010-09-18 23:06:17 -04:00
err_ev7.c alpha: titan and marvel build fixes 2009-05-02 15:36:10 -07:00
err_impl.h alpha: titan and marvel build fixes 2009-05-02 15:36:10 -07:00
err_marvel.c alpha: Use static const char * const where possible 2010-09-18 23:06:17 -04:00
err_titan.c alpha: Use static const char * const where possible 2010-09-18 23:06:17 -04:00
es1888.c
gct.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head.S alpha: convert to use __HEAD and HEAD_TEXT macros. 2009-04-26 09:20:38 -07:00
init_task.c alpha: use .data.init_task instead of .data.init_thread. 2009-09-24 17:16:22 -07:00
io.c
irq_alpha.c alpha: implement HW performance events on the EV67 and later CPUs 2010-08-09 20:45:04 -07:00
irq_i8259.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
irq_impl.h alpha: remove obsolete hw_interrupt_type 2009-06-16 19:47:46 -07:00
irq_pyxis.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
irq_srm.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
irq.c alpha: add performance monitor interrupt counter 2010-08-09 20:45:03 -07:00
machvec_impl.h alpha: fix RTC on marvel 2009-01-15 16:39:40 -08:00
Makefile alpha: implement HW performance events on the EV67 and later CPUs 2010-08-09 20:45:04 -07:00
module.c alpha: handle kcalloc failure 2008-04-28 08:58:27 -07:00
osf_sys.c alpha: kill big kernel lock 2010-09-18 23:06:18 -04:00
pc873xx.c alpha: Detect Super IO chip, no IDE on Avanti, enable EPP19 2010-06-15 14:19:08 -04:00
pc873xx.h alpha: Detect Super IO chip, no IDE on Avanti, enable EPP19 2010-06-15 14:19:08 -04:00
pci_impl.h alpha: AGP update (fixes compile failure) 2009-09-24 07:21:06 -07:00
pci_iommu.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pci-noop.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pci-sysfs.c alpha: remove unnecessary cast from void* in assignment. 2010-09-18 23:06:17 -04:00
pci.c resource/PCI: mark struct resource as const 2010-02-22 16:16:57 -08:00
perf_event.c alpha: convert perf_event to use local_t 2010-08-31 22:46:04 -04:00
process.c Make do_execve() take a const filename pointer 2010-08-17 18:07:43 -07:00
proto.h Fix call to replaced SuperIO functions 2010-08-31 22:45:31 -04:00
ptrace.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
setup.c alpha: bad macro expansion, parameter is member 2009-06-16 19:47:46 -07:00
signal.c alpha: unb0rk sigsuspend() and rt_sigsuspend() 2010-09-18 23:08:28 -04:00
smc37c93x.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
smc37c669.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
smp.c cpumask: arch_send_call_function_ipi_mask: alpha 2009-09-24 09:34:43 +09:30
srm_env.c alpha: remove unnecessary cast from void* in assignment. 2010-09-18 23:06:17 -04:00
srmcons.c alpha: fix trivial section mismatch warnings 2007-07-16 09:05:37 -07:00
sys_alcor.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_cabriolet.c Fix call to replaced SuperIO functions 2010-08-31 22:45:31 -04:00
sys_dp264.c alpha: remove trailing spaces in messages 2010-03-18 22:34:08 -04:00
sys_eb64p.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_eiger.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_jensen.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_marvel.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_miata.c PCI: alpha: use generic pci_swizzle_interrupt_pin() 2009-01-07 11:12:53 -08:00
sys_mikasa.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_nautilus.c alpha: nautilus - fix hang on boot 2009-01-15 16:39:40 -08:00
sys_noritake.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_rawhide.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_ruffian.c arch/alpha/kernel/sys_ruffian.c: Use DIV_ROUND_CLOSEST 2009-11-30 15:37:25 -05:00
sys_rx164.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_sable.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
sys_sio.c alpha: Detect Super IO chip, no IDE on Avanti, enable EPP19 2010-06-15 14:19:08 -04:00
sys_sx164.c alpha: more fixes for specific machine types 2007-04-17 16:36:27 -07:00
sys_takara.c Fix call to replaced SuperIO functions 2010-08-31 22:45:31 -04:00
sys_titan.c alpha: remove trailing spaces in messages 2010-03-18 22:34:08 -04:00
sys_wildfire.c alpha: Fixup last users of irq_chip->typename 2009-11-30 22:51:31 -05:00
systbls.S alpha: wire up fanotify and prlimit64 syscalls 2010-09-18 23:06:19 -04:00
time.c alpha: Shift perf event pending work earlier in timer interrupt 2010-09-18 23:06:19 -04:00
traps.c alpha: kill big kernel lock 2010-09-18 23:06:18 -04:00
vmlinux.lds.S alpha: Fix duplicate <asm/thread_info.h> include 2009-09-27 14:46:05 -07:00