public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* musl-libc/MIPS: detached thread exit broken since kernel commit 46e12c07b
@ 2015-06-19  2:07 Matthias Schiffer
  2015-06-19  2:50 ` [musl] " Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Schiffer @ 2015-06-19  2:07 UTC (permalink / raw)
  To: musl, linux-mips, linux-kernel@vger.kernel.org, Ralf Baechle

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

Hi,
I've come across the issue that applications with detached threads
(using pthread_detach or a pthread_attr_t with
pthread_attr_setdetachstate) will segfault using musl-libc on MIPS as
soon as the detached thread exits. As far as I can tell, the underlying
issue is the following:

To clean up after itself, the finishing thread will call __unmapself,
which will unmap the thread's own stack and call the exit syscall
directly after that, without accessing the now unmapped stack.

This worked fine in 2012, when pthread support for MIPS was implemented
in musl. It seems to have been broken by kernel commit 46e12c07b "MIPS:
O32 / 32-bit: Always copy 4 stack arguments." (also in 2012) which made
the kernel unconditionally copy 4 stack arguments, even when the syscall
doesn't even use the arguments.

I guess this would be reasonably easy to fix up in musl, but let's also
get the linux-mips people's opinions, as that commit obviously broke the
kernel ABI...


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-19 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-19  2:07 musl-libc/MIPS: detached thread exit broken since kernel commit 46e12c07b Matthias Schiffer
2015-06-19  2:50 ` [musl] " Rich Felker
2015-06-19 10:06   ` Ralf Baechle
2015-06-19 14:35     ` Rich Felker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox