From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>,
qemu-arm@nongnu.org, patches@linaro.org
Subject: [Qemu-devel] [RFC] linux-user: Use SIGRTMAX-1 for guest SIGRTMIN+1 to avoid conflict with host libc
Date: Tue, 1 Mar 2016 16:37:20 +0000 [thread overview]
Message-ID: <1456850240-21096-1-git-send-email-peter.maydell@linaro.org> (raw)
We already have a hack whereby we flip the guest's SIGRTMAX and SIGRTMIN
signals, to avoid a collision between guest use of SIGRTMIN and the host
libc use of it for SIGCANCEL. However newer glibc also uses SIGRTMIN+1
for internal purposes (as SIGSETXID). Reverse SIGRTMIN+1 and SIGRTMAX-1
so the guest can successfully use SIGRTMIN+1.
This didn't cause any immediately observed issues in guests because glibc
does not check the return value when it registers a SIGSETXID handler(!).
However it meant that if a guest program with more than one thread issued
a setuid() syscall it would hang.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is sent as an RFC because although I think it is the right thing
it is potentially enabling a bunch of glibc code that we weren't
even going to attempt to run before. Probably this just means a
different style of deadlock if you attempt setuid() calls in a
multithreaded process, though...
Does anybody actually have an idea about how the "manual signal
delivery multiplexed over a single host signal" would work?
linux-user/signal.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 962111c..487cc5f 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -75,8 +75,12 @@ static uint8_t host_to_target_signal_table[_NSIG] = {
/* Nasty hack: Reverse SIGRTMIN and SIGRTMAX to avoid overlap with
host libpthread signals. This assumes no one actually uses SIGRTMAX :-/
To fix this properly we need to do manual signal delivery multiplexed
- over a single host signal. */
+ over a single host signal.
+ Similarly we reverse SIGRTMIN + 1 and SIGRTMAX - 1, because
+ host glibc uses SIGRTMIN+1 for SIGSETXID. */
[__SIGRTMIN] = __SIGRTMAX,
+ [__SIGRTMIN + 1] = __SIGRTMAX - 1,
+ [__SIGRTMAX - 1] = __SIGRTMIN + 1,
[__SIGRTMAX] = __SIGRTMIN,
};
static uint8_t target_to_host_signal_table[_NSIG];
--
1.9.1
reply other threads:[~2016-03-01 16:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456850240-21096-1-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).