qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Holger Freyther <zecke@selfish.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] mips-linux-user and POSIX IPC
Date: Thu, 28 Jul 2011 18:25:16 +0300	[thread overview]
Message-ID: <20110728152516.GA21531@afflict.kos.to> (raw)
In-Reply-To: <loom.20110726T104731-776@post.gmane.org>

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	other threads:[~2011-07-28 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  8:56 [Qemu-devel] mips-linux-user and POSIX IPC Holger Freyther
2011-07-28 15:25 ` Riku Voipio [this message]

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=20110728152516.GA21531@afflict.kos.to \
    --to=riku.voipio@iki.fi \
    --cc=qemu-devel@nongnu.org \
    --cc=zecke@selfish.org \
    /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).