Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-17 Thread Paolo Bonzini
Il 17/08/2013 10:23, Laszlo Ersek ha scritto: > What Paolo posted seems almost identical. > > clz32(l): leading zeros in "l" > qemu_fls(l) == 32 - clz32(l): position of leftmost bit set, 1-based > qemu_fls(l) - 1: position of leftmost bit set, 0-based > > Not sure

Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-17 Thread Alex Williamson
On Sat, 2013-08-17 at 08:33 +0200, Paolo Bonzini wrote: > Il 16/08/2013 23:58, Alex Williamson ha scritto: > > Since commit 23326164 we align access sizes to match the alignment of > > the address, but we don't align the access size itself. This means we > > let illegal access sizes (ex. 3) slip t

Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-17 Thread Alex Williamson
On Sat, 2013-08-17 at 10:23 +0200, Laszlo Ersek wrote: > On 08/16/13 23:58, Alex Williamson wrote: > > Since commit 23326164 we align access sizes to match the alignment of > > the address, but we don't align the access size itself. This means we > > let illegal access sizes (ex. 3) slip through i

Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-17 Thread Laszlo Ersek
(side point) On 08/17/13 10:23, Laszlo Ersek wrote: > if (l >= access_size_max) { > return access_size_max; > } > return 1 << max(3, lmb(l)); lol, of course this should have been min()... Alex's patch is OK of course. Laszlo

Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-17 Thread Laszlo Ersek
On 08/16/13 23:58, Alex Williamson wrote: > Since commit 23326164 we align access sizes to match the alignment of > the address, but we don't align the access size itself. This means we > let illegal access sizes (ex. 3) slip through if the address is > sufficiently aligned (ex. 4). This results

Re: [Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-16 Thread Paolo Bonzini
Il 16/08/2013 23:58, Alex Williamson ha scritto: > Since commit 23326164 we align access sizes to match the alignment of > the address, but we don't align the access size itself. This means we > let illegal access sizes (ex. 3) slip through if the address is > sufficiently aligned (ex. 4). This r

[Qemu-devel] [PATCH v4] exec: Fix non-power-of-2 sized accesses

2013-08-16 Thread Alex Williamson
Since commit 23326164 we align access sizes to match the alignment of the address, but we don't align the access size itself. This means we let illegal access sizes (ex. 3) slip through if the address is sufficiently aligned (ex. 4). This results in an abort which would be easy for a guest to tri