qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Riku Voipio" <riku.voipio@iki.fi>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_posix_timers range
Date: Fri, 22 Aug 2014 14:12:35 +0200	[thread overview]
Message-ID: <53F733B3.6090902@suse.de> (raw)
In-Reply-To: <CAFEAcA_43+XivJ5E4tdJXWsfZWYYL7m7xT1zKCF790qXNdYvhQ@mail.gmail.com>



On 22.08.14 14:07, Peter Maydell wrote:
> On 22 August 2014 12:56, Alexander Graf <agraf@suse.de> wrote:
>> We check whether the passed in timer id is negative on all calls
>> that involve g_posix_timers.
>>
>> However, these checks are bogus. First off we limit the timer_id to
>> 16 bits which is not what Linux does. Then we check whether it's negative
>> which it can't be because we masked it.
>>
>> We can safely remove the masking. For the negativity check we can just
>> treat the timerid as unsigned and only check for upper boundaries.
> 
> Timer IDs aren't unsigned for the kernel; why not just drop
> the mask and keep the <0 checks?

Because I'd then have to carry yet another local patch.

In Linux, the timer id is a "key" into a hash table that the kernel
searches to find its timer. In QEMU it's an offset into an array.

In both cases the syscall user receives it as a token from a create
function and should treat it as opaque.

So in the QEMU case it is unsigned, regardless of what the kernel allows
it to be, because it's an array offset.


Alex

  reply	other threads:[~2014-08-22 12:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 11:56 [Qemu-devel] [PATCH v2] linux-user: Simplify timerid checks on g_posix_timers range Alexander Graf
2014-08-22 12:07 ` Peter Maydell
2014-08-22 12:12   ` Alexander Graf [this message]
2014-08-22 12:25     ` Peter Maydell
2014-08-22 12:29       ` Alexander Graf
2014-08-22 13:00         ` Laurent Vivier
2014-08-22 13:09           ` Peter Maydell
2014-08-22 12:09 ` Laurent Vivier
2014-08-22 13:27   ` Andreas Färber
2014-08-22 13:34     ` Peter Maydell
2014-08-22 13:41       ` Andreas Färber
2014-08-22 13:43         ` Peter Maydell

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=53F733B3.6090902@suse.de \
    --to=agraf@suse.de \
    --cc=afaerber@suse.de \
    --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 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).