qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: fix ipc(SEMCTL, ...) argument handling
@ 2014-06-23 21:40 Paul Burton
  2014-06-23 22:12 ` Peter Maydell
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Burton @ 2014-06-23 21:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Paul Burton

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

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

end of thread, other threads:[~2014-06-24  9:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 21:40 [Qemu-devel] [PATCH] linux-user: fix ipc(SEMCTL, ...) argument handling Paul Burton
2014-06-23 22:12 ` 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

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).