From: Paul Burton <paul@archlinuxmips.org>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, Paul Burton <paul@archlinuxmips.org>
Subject: [Qemu-devel] [PATCH] linux-user: fix ipc(SEMCTL, ...) argument handling
Date: Mon, 23 Jun 2014 22:40:14 +0100 [thread overview]
Message-ID: <1403559614-4096-1-git-send-email-paul@archlinuxmips.org> (raw)
The ptr argument to the ipc syscall was incorrectly being used as the
value of the argument union for the SEMCTL call. It is actually, as its
name would suggest, a pointer to that union. Fix by dereferencing the
pointer to obtain the target argument union.
This fixes fakeroot, or at least version 1.20 for the MIPS target.
Previously it would hang waiting on a semaphore which was not being
initialised to the correct value.
Signed-off-by: Paul Burton <paul@archlinuxmips.org>
---
linux-user/syscall.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 92be371..c70d9d0 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3272,8 +3272,16 @@ static abi_long do_ipc(unsigned int call, int first,
ret = get_errno(semget(first, second, third));
break;
- case IPCOP_semctl:
- ret = do_semctl(first, second, third, (union target_semun)(abi_ulong) ptr);
+ case IPCOP_semctl: {
+ union target_semun *arg;
+
+ if (!lock_user_struct(VERIFY_READ, arg, ptr, 1)) {
+ return -TARGET_EFAULT;
+ }
+
+ ret = do_semctl(first, second, third, *arg);
+ unlock_user_struct(arg, ptr, 0);
+ }
break;
case IPCOP_msgget:
--
2.0.0
next reply other threads:[~2014-06-23 21:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 21:40 Paul Burton [this message]
2014-06-23 22:12 ` [Qemu-devel] [PATCH] linux-user: fix ipc(SEMCTL, ...) argument handling Peter Maydell
2014-06-23 22:18 ` Paul Burton
2014-06-23 22:35 ` Peter Maydell
2014-06-23 23:06 ` Paul Burton
2014-06-23 23:21 ` Peter Maydell
2014-06-23 23:53 ` Paul Burton
2014-06-24 8:19 ` Peter Maydell
2014-06-24 9:13 ` Paul Burton
2014-06-23 22:36 ` Paul Burton
2014-06-23 22:42 ` Peter Maydell
2014-06-23 23:10 ` Paul Burton
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=1403559614-4096-1-git-send-email-paul@archlinuxmips.org \
--to=paul@archlinuxmips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.