qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] m25p80: avoid out of bounds accesses


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/3] m25p80: avoid out of bounds accesses
Date: Tue, 28 Jun 2016 07:42:13 -0400 (EDT)


----- Original Message -----
> From: "Cédric Le Goater" <address@hidden>
> To: "Paolo Bonzini" <address@hidden>, address@hidden
> Sent: Tuesday, June 28, 2016 11:05:24 AM
> Subject: Re: [PATCH 2/3] m25p80: avoid out of bounds accesses
> 
> On 06/28/2016 10:39 AM, Paolo Bonzini wrote:
> > s->cur_addr can be made to point outside s->storage, either by
> > writing a value >= 128 to s->ear (because s->ear * MAX_3BYTES_SIZE
> > is a signed integer and sign-extends into the 64-bit cur_addr),
> > or just by writing an address beyond the size of the flash being
> > emulated.  Avoid the sign extension to make the code cleaner, and
> > on top of that mask s->cur_addr to s->size.
> > 
> > Signed-off-by: Paolo Bonzini <address@hidden>
> 
> Yes. We can trash memory very easily with the m25p80 object so we
> clearly want this fix.
> 
> Maybe, we could add a guest error when going beyond storage and
> the case doing flash_write8() needs some care also.

I don't know, it's quite possible that real hardware does an AND
simply because some address lines are not connected anywhere.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]