838cd153a5
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> |
||
---|---|---|
.. | ||
arc | ||
ddb5xxx | ||
dec | ||
emma2rh | ||
galileo-boards | ||
ip32 | ||
it8172 | ||
jmr3927 | ||
lasat | ||
mach-atlas | ||
mach-au1x00 | ||
mach-cobalt | ||
mach-db1x00 | ||
mach-dec | ||
mach-emma2rh | ||
mach-ev64120 | ||
mach-ev96100 | ||
mach-excite | ||
mach-generic | ||
mach-ip22 | ||
mach-ip27 | ||
mach-ip32 | ||
mach-ja | ||
mach-jazz | ||
mach-jmr3927 | ||
mach-lasat | ||
mach-mips | ||
mach-ocelot | ||
mach-ocelot3 | ||
mach-pb1x00 | ||
mach-pnx8550 | ||
mach-qemu | ||
mach-rm200 | ||
mach-sibyte | ||
mach-sim | ||
mach-wrppmc | ||
mach-yosemite | ||
mips-boards | ||
pci | ||
sgi | ||
sibyte | ||
sn | ||
tx4927 | ||
tx4938 | ||
vr41xx | ||
xtalk | ||
8253pit.h | ||
a.out.h | ||
abi.h | ||
addrspace.h | ||
apm.h | ||
asm.h | ||
asmmacro-32.h | ||
asmmacro-64.h | ||
asmmacro.h | ||
atomic.h | ||
auxvec.h | ||
bcache.h | ||
bitops.h | ||
bootinfo.h | ||
branch.h | ||
break.h | ||
bug.h | ||
bugs.h | ||
byteorder.h | ||
cache.h | ||
cachectl.h | ||
cacheflush.h | ||
cacheops.h | ||
checksum.h | ||
compat.h | ||
compiler.h | ||
cpu-features.h | ||
cpu-info.h | ||
cpu.h | ||
cputime.h | ||
current.h | ||
debug.h | ||
delay.h | ||
div64.h | ||
dma-mapping.h | ||
dma.h | ||
ds1286.h | ||
ds1742.h | ||
dsp.h | ||
elf.h | ||
emergency-restart.h | ||
errno.h | ||
fcntl.h | ||
fixmap.h | ||
floppy.h | ||
fpregdef.h | ||
fpu_emulator.h | ||
fpu.h | ||
futex.h | ||
gdb-stub.h | ||
gfx.h | ||
gt64120.h | ||
gt64240.h | ||
hardirq.h | ||
hazards.h | ||
highmem.h | ||
hw_irq.h | ||
i8259.h | ||
ide.h | ||
inst.h | ||
interrupt.h | ||
inventory.h | ||
io.h | ||
ioctl.h | ||
ioctls.h | ||
ipc.h | ||
ipcbuf.h | ||
irq_cpu.h | ||
irq.h | ||
isadep.h | ||
it8712.h | ||
jazz.h | ||
jazzdma.h | ||
kmap_types.h | ||
kspd.h | ||
linkage.h | ||
local.h | ||
m48t35.h | ||
m48t37.h | ||
marvell.h | ||
mc146818-time.h | ||
mc146818rtc.h | ||
mips_mt.h | ||
mipsmtregs.h | ||
mipsprom.h | ||
mipsregs.h | ||
mman.h | ||
mmu_context.h | ||
mmu.h | ||
mmzone.h | ||
module.h | ||
msc01_ic.h | ||
msgbuf.h | ||
mutex.h | ||
namei.h | ||
nile4.h | ||
paccess.h | ||
page.h | ||
param.h | ||
parport.h | ||
pci.h | ||
percpu.h | ||
pgalloc.h | ||
pgtable-32.h | ||
pgtable-64.h | ||
pgtable-bits.h | ||
pgtable.h | ||
pmon.h | ||
poll.h | ||
posix_types.h | ||
prctl.h | ||
prefetch.h | ||
processor.h | ||
ptrace.h | ||
qemu.h | ||
r4kcache.h | ||
reboot.h | ||
reg.h | ||
regdef.h | ||
resource.h | ||
rm9k-ocd.h | ||
rtc.h | ||
rtlx.h | ||
scatterlist.h | ||
sections.h | ||
segment.h | ||
semaphore.h | ||
sembuf.h | ||
serial.h | ||
setup.h | ||
sgialib.h | ||
sgiarcs.h | ||
sgidefs.h | ||
shmbuf.h | ||
shmparam.h | ||
sigcontext.h | ||
siginfo.h | ||
signal.h | ||
sim.h | ||
smp.h | ||
smtc_ipi.h | ||
smtc_proc.h | ||
smtc.h | ||
sni.h | ||
socket.h | ||
sockios.h | ||
sparsemem.h | ||
spinlock_types.h | ||
spinlock.h | ||
stackframe.h | ||
stat.h | ||
statfs.h | ||
string.h | ||
suspend.h | ||
sysmips.h | ||
system.h | ||
termbits.h | ||
termios.h | ||
thread_info.h | ||
time.h | ||
timex.h | ||
titan_dep.h | ||
tlb.h | ||
tlbdebug.h | ||
tlbflush.h | ||
topology.h | ||
traps.h | ||
tx3912.h | ||
types.h | ||
uaccess.h | ||
ucontext.h | ||
unaligned.h | ||
unistd.h | ||
user.h | ||
vga.h | ||
vpe.h | ||
war.h | ||
watch.h | ||
wbflush.h | ||
xor.h | ||
xxs1500.h |