From: Eric Blake <eblake@redhat.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/4] ahci: Do not ignore memory access read size
Date: Mon, 15 Jun 2015 22:04:56 -0600 [thread overview]
Message-ID: <557FA068.8000202@redhat.com> (raw)
In-Reply-To: <557F6359.9060002@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
On 06/15/2015 05:44 PM, John Snow wrote:
>> Note that while this returns the desired 16 or 32 bits in the low
>> order side of the result, it does not guarantee that the remaining
>> upper bytes are all 0. I don't know if it matters to callers, or
>> even what real hardware does, but you may want to mask things at
>> both return statements, to guarantee a stable result limited to
>> size bytes of information rather than leaking nearby bytes from the
>> rest of the registers being read.
>
>
> I believe the masking is handled by the memory system in general, see
> memory_region_read_accessor, which masks the returned uint64_t with an
> appropriate value set earlier by access_with_adjusted_size:
>
> access_mask = -1ULL >> (64 - access_size * 8);
Good, the caller takes care of it.
>
> So we're probably OK here, but I can leave a comment if you think it's
> too hand-wavey.
Yeah, always nicer to state our assumption that we rely on the caller to
truncate the result to the desired access size.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-06-16 4:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 22:22 [Qemu-devel] [PATCH 0/4] ahci: misc fixes/tests for 2.4 John Snow
2015-06-15 22:22 ` [Qemu-devel] [PATCH 1/4] ahci: Do not ignore memory access read size John Snow
2015-06-15 22:55 ` Eric Blake
2015-06-15 23:09 ` John Snow
2015-06-15 23:28 ` Eric Blake
2015-06-15 23:44 ` John Snow
2015-06-16 4:04 ` Eric Blake [this message]
2015-06-15 22:22 ` [Qemu-devel] [PATCH 2/4] qtest/ahci: add test_max John Snow
2015-06-15 22:22 ` [Qemu-devel] [PATCH 3/4] libqos/ahci: fix memory management bugs John Snow
2015-06-15 22:22 ` [Qemu-devel] [PATCH 4/4] qtest/ahci: add port_reset test John Snow
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=557FA068.8000202@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.