[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/4] ahci: Do not ignore memory access read size
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/4] ahci: Do not ignore memory access read size |
Date: |
Mon, 15 Jun 2015 22:04:56 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
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
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 3/4] libqos/ahci: fix memory management bugs, John Snow, 2015/06/15
[Qemu-devel] [PATCH 2/4] qtest/ahci: add test_max, John Snow, 2015/06/15
[Qemu-devel] [PATCH 4/4] qtest/ahci: add port_reset test, John Snow, 2015/06/15