qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH 0/3] Fix access_with_adjusted_size() on big-endian
       [not found] <20180927002416.1781-1-f4bug@amsat.org>
@ 2018-10-02 12:18 ` Peter Maydell
  2018-10-02 12:34   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2018-10-02 12:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, QEMU Developers, KONRAD Frederic, Andrew Jeffery,
	Cédric Le Goater

On 27 September 2018 at 01:24, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi,
>
> This series fix a bug I'v been hunting for a long time.
>
> With BE regions, if the guest used smaller access than the region
> implementation, the shift value is negative, but since access_fn()
> uses unsigned type for shift, it result in a huge positive value,
> then accessors shift the value which eventually becomes 0.
>
> The fix is simply to use signed type for the shift, and shift to
> the opposite direction for negative values.

Series
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

I guess we don't have very many devices that are BE and
that allow the guest to access them with a smaller
width than their implemented width...

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] Fix access_with_adjusted_size() on big-endian
  2018-10-02 12:18 ` [Qemu-devel] [PATCH 0/3] Fix access_with_adjusted_size() on big-endian Peter Maydell
@ 2018-10-02 12:34   ` Philippe Mathieu-Daudé
  2018-10-02 12:35     ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-02 12:34 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Andrew Jeffery, Cédric Le Goater

On Tue, Oct 2, 2018 at 2:19 PM Peter Maydell <peter.maydell@linaro.org> wrote:
> On 27 September 2018 at 01:24, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> > Hi,
> >
> > This series fix a bug I'v been hunting for a long time.
> >
> > With BE regions, if the guest used smaller access than the region
> > implementation, the shift value is negative, but since access_fn()
> > uses unsigned type for shift, it result in a huge positive value,
> > then accessors shift the value which eventually becomes 0.
> >
> > The fix is simply to use signed type for the shift, and shift to
> > the opposite direction for negative values.
>
> Series
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks for reviewing this.

> I guess we don't have very many devices that are BE and
> that allow the guest to access them with a smaller
> width than their implemented width...

Do you think is it worth using the '(un)likely()' macros?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] Fix access_with_adjusted_size() on big-endian
  2018-10-02 12:34   ` Philippe Mathieu-Daudé
@ 2018-10-02 12:35     ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-10-02 12:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Andrew Jeffery, Cédric Le Goater

On 2 October 2018 at 13:34, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> On Tue, Oct 2, 2018 at 2:19 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 27 September 2018 at 01:24, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> > Hi,
>> >
>> > This series fix a bug I'v been hunting for a long time.
>> >
>> > With BE regions, if the guest used smaller access than the region
>> > implementation, the shift value is negative, but since access_fn()
>> > uses unsigned type for shift, it result in a huge positive value,
>> > then accessors shift the value which eventually becomes 0.
>> >
>> > The fix is simply to use signed type for the shift, and shift to
>> > the opposite direction for negative values.
>>
>> Series
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> Thanks for reviewing this.
>
>> I guess we don't have very many devices that are BE and
>> that allow the guest to access them with a smaller
>> width than their implemented width...
>
> Do you think is it worth using the '(un)likely()' macros?

Probably not; that was just a comment on why we haven't run
into the bug sooner.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-02 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20180927002416.1781-1-f4bug@amsat.org>
2018-10-02 12:18 ` [Qemu-devel] [PATCH 0/3] Fix access_with_adjusted_size() on big-endian Peter Maydell
2018-10-02 12:34   ` Philippe Mathieu-Daudé
2018-10-02 12:35     ` Peter Maydell

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).