qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] mips-linux-user and POSIX IPC


From: Riku Voipio
Subject: Re: [Qemu-devel] mips-linux-user and POSIX IPC
Date: Thu, 28 Jul 2011 18:25:16 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Jul 26, 2011 at 08:56:38AM +0000, Holger Freyther wrote:
> For semctl qemu enters through the do_ipc method, it appears
> to be that the 'variable' ptr is really a ptr (to the stack) and
> needs to be dereferenced. The below snippet seems to fix that
> issue for me.
 
> My next problem is with do_shmctl, somehow third is NULL but it
> should point to the out parameter (and the application is doing
> this correctly as well). While trying to understand the issue it
> looks like target_to_host_shmid_ds will not properly unlock the
> struct on all paths.
 
> Is the IPC emulation supposed to work? Is this an 'obvious' API
> issue for MIPS?

The ltp testsuite has many semaphore and other ipc tests. Comparing
results of running the same ltp binaries on real mips and qemu-mips
should quickly reveal which syscall emulations are broken. And provide
a good testcase for fixes.

> @@ -2873,7 +2886,13 @@ static abi_long do_ipc(
>          break;
>  
>      case IPCOP_semctl:
> -        ret = do_semctl(first, second, third, (union \n
> target_semun)(abi_ulong) ptr);
> +        if (!lock_user_struct(VERIFY_READ, semun, ptr, 1))
> +               ret = -TARGET_EFAULT;
> +       else {
> +               __get_user(t_semun.buf, &semun->buf);
> +               ret = do_semctl(first, second, third, t_semun);
> +               unlock_user_struct(semun, ptr, 0);
> +       }
>          break;

This looks from a quick view a correct fix.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]