From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Qemu-block <qemu-block@nongnu.org>,
"Alistair Francis" <alistair@alistair23.me>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Niek Linnenbank" <nieklinnenbank@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Alistair Francis" <alistair23@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes
Date: Thu, 9 Jul 2020 15:15:12 +0100 [thread overview]
Message-ID: <CAFEAcA8em-bgU2xd8OG+bPLDCSZCF8Y2ay9U57D8p9m1SWO=9g@mail.gmail.com> (raw)
In-Reply-To: <e87550d9-e1cc-cc15-2674-755249e9a965@amsat.org>
On Thu, 9 Jul 2020 at 14:56, Philippe Mathieu-Daudé <f4bug@amsat.org> 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 'off-the-shelf' images as well.
> > For example, the latest Raspbian image size also isn't a power of two:
> >
> > $ ./arm-softmmu/qemu-system-arm -M raspi2 -sd
> > ~/Downloads/2020-05-27-raspios-buster-lite-armhf.img -nographic
> > WARNING: Image format was not specified for
> > '/home/me/Downloads/2020-05-27-raspios-buster-lite-armhf.img' and
> > probing guessed raw.
> > Automatically detecting the format is dangerous for raw images,
> > write operations on block 0 will be restricted.
> > Specify the 'raw' format explicitly to remove the restrictions.
> > qemu-system-arm: Invalid SD card size: 1.73 GiB (expecting at least 2 GiB)
> >
> > If we do decide that the change is needed, I would like to propose that
> > we also give the user some instructions
> > on how to fix it, maybe some 'dd' command?
>
> On POSIX we can suggest to use 'truncate -s 2G' from coreutils.
> This is not in the default Darwin packages.
> On Windows I have no clue.
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". But I'm a bit
wary of having an error message that recommends that, because
what if we got it wrong?
thanks
-- PMM
next prev parent reply other threads:[~2020-07-09 14:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 13:21 [PATCH 0/2] hw/sd/sdcard: Fix CVE-2020-13253 (Do not allow invalid SD card sizes) Philippe Mathieu-Daudé
2020-07-07 13:21 ` [PATCH 1/2] tests/acceptance/boot_linux: Truncate SD card image to power of 2 Philippe Mathieu-Daudé
2020-07-07 15:53 ` Alistair Francis
2020-07-07 16:10 ` Philippe Mathieu-Daudé
2020-07-12 18:43 ` Niek Linnenbank
2020-07-07 13:21 ` [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes Philippe Mathieu-Daudé
2020-07-07 15:55 ` Alistair Francis
2020-07-07 16:06 ` Peter Maydell
2020-07-07 16:11 ` Philippe Mathieu-Daudé
2020-07-07 20:29 ` Niek Linnenbank
2020-07-09 13:56 ` Philippe Mathieu-Daudé
2020-07-09 14:15 ` Peter Maydell [this message]
2020-07-09 14:35 ` Philippe Mathieu-Daudé
2020-07-09 16:17 ` Alistair Francis
2020-07-10 9:54 ` Peter Maydell
2020-07-09 17:56 ` Niek Linnenbank
2020-07-10 9:58 ` Kevin Wolf
2020-07-10 9:59 ` Peter Maydell
2020-07-10 12:07 ` Kevin Wolf
2020-07-10 12:30 ` Peter Maydell
2020-07-09 17:53 ` Niek Linnenbank
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFEAcA8em-bgU2xd8OG+bPLDCSZCF8Y2ay9U57D8p9m1SWO=9g@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=alistair23@gmail.com \
--cc=alistair@alistair23.me \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=nieklinnenbank@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).