Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-10 Thread Peter Maydell
On Fri, 10 Jul 2020 at 13:07, Kevin Wolf wrote: > > Am 10.07.2020 um 11:59 hat Peter Maydell geschrieben: > > On Fri, 10 Jul 2020 at 10:58, Kevin Wolf wrote: > > > > > > Am 09.07.2020 um 16:15 hat Peter Maydell geschrieben: > > > > dd/truncate etc won't work if the image file is not raw (eg if >

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-10 Thread Kevin Wolf
Am 10.07.2020 um 11:59 hat Peter Maydell geschrieben: > On Fri, 10 Jul 2020 at 10:58, Kevin Wolf wrote: > > > > Am 09.07.2020 um 16:15 hat Peter Maydell geschrieben: > > > dd/truncate etc won't work if the image file is not raw (eg if > > > it's qcow2). The only chance you have of something

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-10 Thread Peter Maydell
On Fri, 10 Jul 2020 at 10:58, Kevin Wolf wrote: > > Am 09.07.2020 um 16:15 hat Peter Maydell geschrieben: > > dd/truncate etc won't work if the image file is not raw (eg if > > it's qcow2). The only chance you have of something that's actually > > generic would probably involve "qemu-img resize".

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-10 Thread Kevin Wolf
Am 09.07.2020 um 16:15 hat Peter Maydell geschrieben: > On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé wrote: > > > > On 7/7/20 10:29 PM, Niek Linnenbank wrote: > > > So I manually copy & pasted the change into hw/sd/sd.c to test it. > > > It looks like the check works, but my concern is

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-10 Thread Peter Maydell
On Thu, 9 Jul 2020 at 17:27, Alistair Francis wrote: > > On Thu, Jul 9, 2020 at 7:35 AM Philippe Mathieu-Daudé wrote: > > > > On 7/9/20 4:15 PM, Peter Maydell wrote: > > > The only chance you have of something that's actually > > > generic would probably involve "qemu-img resize". But I'm a bit

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Niek Linnenbank
On Thu, Jul 9, 2020 at 4:15 PM Peter Maydell wrote: > On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé > wrote: > > > > On 7/7/20 10:29 PM, Niek Linnenbank wrote: > > > So I manually copy & pasted the change into hw/sd/sd.c to test it. > > > It looks like the check works, but my concern is

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Niek Linnenbank
On Thu, Jul 9, 2020 at 3:56 PM Philippe Mathieu-Daudé wrote: > On 7/7/20 10:29 PM, Niek Linnenbank wrote: > > Hi Philippe, > > > > Just tried out your patch on latest master, and I noticed I couldn't > > apply it without getting this error: > > > > $ git am ~/Downloads/patches/\[PATCH\ 2_2\]\

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Alistair Francis
On Thu, Jul 9, 2020 at 7:35 AM Philippe Mathieu-Daudé wrote: > > On 7/9/20 4:15 PM, Peter Maydell wrote: > > On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé wrote: > >> > >> On 7/7/20 10:29 PM, Niek Linnenbank wrote: > >>> So I manually copy & pasted the change into hw/sd/sd.c to test it. >

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Philippe Mathieu-Daudé
On 7/9/20 4:15 PM, Peter Maydell wrote: > On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé wrote: >> >> On 7/7/20 10:29 PM, Niek Linnenbank wrote: >>> So I manually copy & pasted the change into hw/sd/sd.c to test it. >>> It looks like the check works, but my concern is that with this change,

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Peter Maydell
On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé wrote: > > On 7/7/20 10:29 PM, Niek Linnenbank wrote: > > So I manually copy & pasted the change into hw/sd/sd.c to test it. > > It looks like the check works, but my concern is that with this change, > > we will be getting this error on

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-09 Thread Philippe Mathieu-Daudé
On 7/7/20 10:29 PM, Niek Linnenbank wrote: > Hi Philippe, > > Just tried out your patch on latest master, and I noticed I couldn't > apply it without getting this error: > > $ git am ~/Downloads/patches/\[PATCH\ 2_2\]\ hw_sd_sdcard\:\ Do\ not\ > allow\ invalid\ SD\ card\ sizes\ -\ Philippe\

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Niek Linnenbank
Hi Philippe, Just tried out your patch on latest master, and I noticed I couldn't apply it without getting this error: $ git am ~/Downloads/patches/\[PATCH\ 2_2\]\ hw_sd_sdcard\:\ Do\ not\ allow\ invalid\ SD\ card\ sizes\ -\ Philippe\ Mathieu-Daudé\ \< f4...@amsat.org\>\ -\ 2020-07-07\ 1521.eml

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Philippe Mathieu-Daudé
On 7/7/20 6:06 PM, Peter Maydell wrote: > On Tue, 7 Jul 2020 at 17:04, Alistair Francis wrote: >> >> On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé >> wrote: >>> >>> QEMU allows to create SD card with unrealistic sizes. This could work, >>> but some guests (at least Linux) consider sizes

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Peter Maydell
On Tue, 7 Jul 2020 at 17:04, Alistair Francis wrote: > > On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé wrote: > > > > QEMU allows to create SD card with unrealistic sizes. This could work, > > but some guests (at least Linux) consider sizes that are not a power > > of 2 as a firmware bug

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Alistair Francis
On Tue, Jul 7, 2020 at 6:22 AM Philippe Mathieu-Daudé wrote: > > QEMU allows to create SD card with unrealistic sizes. This could work, > but some guests (at least Linux) consider sizes that are not a power > of 2 as a firmware bug and fix the card size to the next power of 2. > > Before

[PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes

2020-07-07 Thread Philippe Mathieu-Daudé
QEMU allows to create SD card with unrealistic sizes. This could work, but some guests (at least Linux) consider sizes that are not a power of 2 as a firmware bug and fix the card size to the next power of 2. Before CVE-2020-13253 fix, this would allow OOB read/write accesses past the image size