linux-stable-rt/include/asm-mips
akpm@osdl.org 838cd153a5 [PATCH] N32 sigset and __COMPAT_ENDIAN_SWAP__
I'm testing glibc on MIPS64, little-endian, N32, O32 and N64 multilibs.

Among the NPTL test failures seen are some arising from sigsuspend problems
for N32: it blocks the wrong signals, so SIGCANCEL (SIGRTMIN) is blocked
despite glibc's carefully excluding it from sets of signals to block.
Specifically, testing suggests it blocks signal N^32 instead of signal N,
so (in the example tested) blocking SIGUSR1 (17) blocks signal 49 instead.

glibc's sigset_t uses an array of unsigned long, as does the kernel.
In both cases, signal N+1 is represented as
(1UL << (N % (8 * sizeof (unsigned long)))) in word number
(N / (8 * sizeof (unsigned long))).

Thus the N32 glibc uses an array of 32-bit words and the N64 kernel uses an
array of 64-bit words.  For little-endian, the layout is the same, with
signals 1-32 in the first 4 bytes, signals 33-64 in the second, etc.; for
big-endian, userspace has that layout while in the kernel each 8 bytes have
the two halves swapped from the userspace layout.

The N32 sigsuspend syscall uses sigset_from_compat to convert the userspace
sigset to kernel format.  If __COMPAT_ENDIAN_SWAP__ is *not* set, this uses
logic of the form

  set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 )

to convert the userspace sigset to a kernel one.  This looks correct to me
for both big and little endian, given that in userspace compat->sig[1] will
represent signals 33-64, and so will the high 32 bits of set->sig[0] in the
kernel.  If however __COMPAT_ENDIAN_SWAP__ *is* set, as it is for
__MIPSEL__, it uses

  set->sig[0] = compat->sig[1] | (((long)compat->sig[0]) << 32 );

which seems incorrect for both big and little endian, and would
explain the observed symptoms.

This code is the only use of __COMPAT_ENDIAN_SWAP__, so if incorrect
then that macro serves no purpose, in which case something like the
following patch would seem appropriate to remove it.

Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-25 10:01:15 -07:00
..
arc Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ddb5xxx Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
dec Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emma2rh [MIPS] Support for the R5500-based NEC EMMA2RH Mark-eins board 2006-06-19 17:39:26 +01:00
galileo-boards
ip32 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
it8172
jmr3927 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
lasat [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
mach-atlas
mach-au1x00 [PATCH] Au1550/1200: add missing PSC #define's, make OSS driver use the proper ones 2006-06-23 07:42:56 -07:00
mach-cobalt Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mach-db1x00 [PATCH] Au1550/1200: add missing PSC #define's, make OSS driver use the proper ones 2006-06-23 07:42:56 -07:00
mach-dec [MIPS] Make timer interrupt frequency configurable from kconfig. 2006-06-19 17:39:27 +01:00
mach-emma2rh [MIPS] Support for the R5500-based NEC EMMA2RH Mark-eins board 2006-06-19 17:39:26 +01:00
mach-ev64120
mach-ev96100
mach-excite [MIPS] Support for the RM9000-based Basler eXcite smart camera platform. 2006-06-19 17:39:26 +01:00
mach-generic [PATCH] random: remove SA_SAMPLE_RANDOM from floppy driver 2006-06-25 10:01:00 -07:00
mach-ip22 Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
mach-ip27 [MIPS] Add Missing R4K Cache Macros to IP27 & IP32 2006-06-19 17:39:26 +01:00
mach-ip32 Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
mach-ja MIPS: Introduce machinery for testing for MIPSxxR1/2. 2006-01-10 13:39:06 +00:00
mach-jazz [PATCH] random: remove SA_SAMPLE_RANDOM from floppy driver 2006-06-25 10:01:00 -07:00
mach-jmr3927 [MIPS] JMR3927 build fixes for the RTC code. 2006-04-19 04:14:20 +02:00
mach-lasat
mach-mips Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
mach-ocelot
mach-ocelot3 MIPS: Introduce machinery for testing for MIPSxxR1/2. 2006-01-10 13:39:06 +00:00
mach-pb1x00 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mach-pnx8550 Philips PNX8550 support: MIPS32-like core with 2 Trimedias on it. 2005-10-29 19:31:54 +01:00
mach-qemu [MIPS] Make timer interrupt frequency configurable from kconfig. 2006-06-19 17:39:27 +01:00
mach-rm200 [MIPS] Fix R4K cache macro names 2006-06-19 17:39:26 +01:00
mach-sibyte Support the MIPS32 / MIPS64 DSP ASE. 2005-10-29 19:31:17 +01:00
mach-sim Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
mach-wrppmc [MIPS] Wind River 4KC PPMC Eval Board Support 2006-06-19 17:39:18 +01:00
mach-yosemite MIPS: Introduce machinery for testing for MIPSxxR1/2. 2006-01-10 13:39:06 +00:00
mips-boards Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-04-29 01:42:26 +01:00
pci [MIPS] SN: include asm/sn/types.h for nasid_t. 2006-06-19 17:39:24 +01:00
sgi [PATCH] sgiseeq: Configure PIO and DMA timing requests. 2005-10-18 18:03:47 -04:00
sibyte Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
sn Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
tx4927 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
tx4938 Support for Toshiba's RBHMA4500 eval board for the TX4938. 2005-10-29 19:31:57 +01:00
vr41xx Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
xtalk
8253pit.h
a.out.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
abi.h [MIPS] Make do_signal return void. 2006-02-08 17:52:25 +00:00
addrspace.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
apm.h [MIPS] APM emu support 2006-06-19 17:39:22 +01:00
asm.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
asmmacro-32.h [MIPS] Fix fpu_save_double on 64-bit. 2006-06-19 17:39:13 +01:00
asmmacro-64.h [MIPS] Fix fpu_save_double on 64-bit. 2006-06-19 17:39:13 +01:00
asmmacro.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
atomic.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bcache.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
bitops.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-04-29 01:42:26 +01:00
bootinfo.h [MIPS] Support for the RM9000-based Basler eXcite smart camera platform. 2006-06-19 17:39:26 +01:00
branch.h
break.h Allocate break code 513 to KDB. 2005-10-29 19:30:34 +01:00
bug.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
bugs.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
byteorder.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cache.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cachectl.h
cacheflush.h [MIPS] Handle IDE PIO cache aliases on SMP. 2006-04-19 04:14:29 +02:00
cacheops.h
checksum.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
compat.h [PATCH] N32 sigset and __COMPAT_ENDIAN_SWAP__ 2006-06-25 10:01:15 -07:00
compiler.h
cpu-features.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cpu-info.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cpu.h [MIPS] Treat R14000 like R10000. 2006-06-01 00:28:35 +01:00
cputime.h
current.h
debug.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
delay.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
div64.h
dma-mapping.h [PATCH] gfp_t: dma-mapping (mips) 2005-10-28 08:16:48 -07:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ds1286.h
ds1742.h [MIPS] JMR3927 build fixes for the RTC code. 2006-04-19 04:14:20 +02:00
dsp.h MIPS: DSP: Set all register masks to 0x3ff. 2006-01-10 13:39:04 +00:00
elf.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emergency-restart.h [PATCH] Add emergency_restart() 2005-07-26 14:35:41 -07:00
errno.h Delete duplicate definitions. 2005-11-07 18:05:40 +00:00
fcntl.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
fixmap.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
floppy.h
fpregdef.h [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
fpu.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
fpu_emulator.h [MIPS] Unify mips_fpu_soft_struct and mips_fpu_hard_structs. 2006-06-19 17:39:18 +01:00
futex.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
gdb-stub.h
gfx.h
gt64120.h
gt64240.h
hardirq.h
hazards.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
highmem.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
hw_irq.h
i8259.h
ide.h
inst.h [MIPS] Update/Fix instruction definitions 2006-06-01 00:28:34 +01:00
interrupt.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
inventory.h Reformatting, remove debugging code. 2005-10-29 19:30:57 +01:00
io.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ioctl.h
ioctls.h
ipc.h
ipcbuf.h
irq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
irq_cpu.h
isadep.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
it8712.h
jazz.h
jazzdma.h
kmap_types.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
kspd.h [MIPS] kpsd and other AP/SP improvements. 2006-04-19 04:14:27 +02:00
linkage.h [PATCH] abstract type/size specification for assembly 2006-03-24 07:33:25 -08:00
local.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
m48t35.h
m48t37.h
marvell.h [MIPS] MV6434x: Add prototype of interrupt dispatch function. 2006-04-19 04:14:20 +02:00
mc146818-time.h [PATCH] RTC: Remove RTC UIP synchronization on MIPS MC146818 2006-03-28 09:16:00 -08:00
mc146818rtc.h
mips_mt.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
mipsmtregs.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
mipsprom.h
mipsregs.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmu.h
mmu_context.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mmzone.h [PATCH] Delete unused definitions of kvaddr_to_nid 2006-06-23 07:42:52 -07:00
module.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
msc01_ic.h
msgbuf.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h
nile4.h
paccess.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
page.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
param.h [MIPS] Make timer interrupt frequency configurable from kconfig. 2006-06-19 17:39:27 +01:00
parport.h
pci.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
percpu.h
pgalloc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable-32.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
pgtable-64.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
pgtable-bits.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
pmon.h
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h
prctl.h
prefetch.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
processor.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
ptrace.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
qemu.h [MIPS] Qemu system shutdown support 2006-06-19 17:39:19 +01:00
r4kcache.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
reboot.h [MIPS] Rename _machine_power_off to pm_power_off so the kernel builds again. 2006-02-07 13:30:22 +00:00
reg.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
regdef.h
resource.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
rm9k-ocd.h [MIPS] Support for the RM9000-based Basler eXcite smart camera platform. 2006-06-19 17:39:26 +01:00
rtc.h [MIPS] Fix genrtc compilation. 2006-04-19 04:14:22 +02:00
rtlx.h [MIPS] kpsd and other AP/SP improvements. 2006-04-19 04:14:27 +02:00
scatterlist.h
sections.h
segment.h
semaphore.h [PATCH] semaphore: Remove __MUTEX_INITIALIZER() 2005-10-30 17:37:27 -08:00
sembuf.h
serial.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
setup.h
sgialib.h
sgiarcs.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
sgidefs.h
shmbuf.h
shmparam.h
sigcontext.h [MIPS] Update struct sigcontext member names 2006-06-01 00:28:31 +01:00
siginfo.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
signal.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
sim.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
smp.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
smtc.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
smtc_ipi.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
smtc_proc.h [MIPS] MT: Improved multithreading support. 2006-04-19 04:14:28 +02:00
sni.h [MIPS] Support SNI RM200C SNI in big endian mode and R5000 processors. 2006-06-19 17:39:24 +01:00
socket.h Add SOCK_DCCP definition for MIPS also. 2005-10-29 19:32:26 +01:00
sockios.h
sparsemem.h [MIPS] Fix sparsemem support. 2006-06-06 00:15:20 +01:00
spinlock.h More configcheck fixes. 2005-10-29 19:32:40 +01:00
spinlock_types.h [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
stackframe.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
stat.h
statfs.h [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
string.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
suspend.h
sysmips.h
system.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
termbits.h It's UTF-8 2006-03-22 00:13:35 +01:00
termios.h
thread_info.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
time.h [PATCH] mips: fixed collision of rtc function name 2006-03-27 08:44:50 -08:00
timex.h
titan_dep.h [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00
tlb.h
tlbdebug.h
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
topology.h
traps.h More AP / SP bits for the 34K, the Malta bits and things. Still wants 2005-10-29 19:31:53 +01:00
tx3912.h
types.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
uaccess.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ucontext.h
unaligned.h
unistd.h Remove unneeded _syscallX macros from user view in asm-*/unistd.h 2006-04-29 01:51:47 +01:00
user.h
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
vpe.h [MIPS] kpsd and other AP/SP improvements. 2006-04-19 04:14:27 +02:00
war.h Merge git://git.infradead.org/hdrcleanup-2.6 2006-06-20 15:10:08 -07:00
watch.h
wbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
xor.h
xxs1500.h [PATCH] mips: nuke trailing whitespace 2005-09-05 00:06:07 -07:00