From: Paul Burton <paul@archlinuxmips.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>,
QEMU Developers <qemu-devel@nongnu.org>,
Paul Burton <paul@archlinuxmips.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: fix ipc(SEMCTL, ...) argument handling
Date: Tue, 24 Jun 2014 00:10:10 +0100 [thread overview]
Message-ID: <20140623231010.GF4377@gmail.com> (raw)
In-Reply-To: <CAFEAcA8n_6L0gQy3H2ogi-AvrqadiK4Y7euhtbnuQOQK8EVMoQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]
On Mon, Jun 23, 2014 at 11:42:14PM +0100, Peter Maydell wrote:
> On 23 June 2014 23:36, Paul Burton <paul@archlinuxmips.org> wrote:
> > Actually no, I don't think you're right about that afterall. The
> > argument union itself is never modified. I imagine if it were then it
> > would be painful in the case of the semctl syscall where the union is
> > passed directly as an argument, rather than as a pointer as it is for
> > the ipc syscall.
> >
> > What may be modified is the data pointed to by the pointers within union
> > semun. That is already handled by do_semctl & the translate functions it
> > calls.
>
> Except if you look at do_semctl you see code like:
> case GETVAL:
> case SETVAL:
> arg.val = tswap32(target_su.val);
> ret = get_errno(semctl(semid, semnum, cmd, arg));
> target_su.val = tswap32(arg.val);
> break;
>
> which clearly is just modifying fields in the target_semun union.
> So something's wrong (probably that code)...
Yes, both Linux & man semctl agree that GETVAL returns the value of
the semaphore as the return value of the syscall. So I believe the
assignment to target_su.val there is (functionally harmless) garbage.
Thanks,
Paul
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-06-23 23:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 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=20140623231010.GF4377@gmail.com \
--to=paul@archlinuxmips.org \
--cc=peter.maydell@linaro.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.