Use a non RT signal on Android since its userland is not very keep to it.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 21 Jan 2013 23:49:50 +0000 (18:49 -0500)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 28 Jan 2013 16:27:18 +0000 (11:27 -0500)
commit5005c6f3fbc1da584c6a550281689cc23f59fe6d
tree459d607f74a99556dec747a6e731adf86dddcb07
parent0ad6ffdecaf4b3793e21559101af5b3a7ee181de
Use a non RT signal on Android since its userland is not very keep to it.

* threads.c: On Android we now use SIGUNUSED instead of RT2 since bionic
exposes a 32bits sigset_t which cannot accommodate signals in the RT range.

The alternative would be to directly syscall the kernel and use the RT range,
but that would mean patch all functions that deal with sigset_t to use a wrapper.
So, given the effort/result of it on this case. It makes more sense to just
use an unused signal for that.

The linux kernel has 2 syscall APIs for signals, the regular one and the rt
variant. EG, we have sys_sigprocmask and sys_rt_sigprocmask.

The regular one works with 32bits sigset_t while the rt_ variant deals with
64bits (128bits on mips) sigset_t. This is, I believe, largely due to legacy
support for old glibc when they added support for RT signals in a very very
distant past - before the kernel git epoch.

Said that, bionic, for some reason, decided to go with the old one. Android's
kernel has full support for RT signals, which makes the whole thing even more
interesting. I could not figure out why it ended up like that, probably some
historical accident that was never noticed.

Current bionic (Jelly Bean 4.2.1) function that operate on sigset_t don't
perform any bounds check which, when using signal 33, leads to memory corruption.
On our case it leads to stack corruption and random crashes.
mono/metadata/threads.c