All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niek Linnenbank <nieklinnenbank@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Qemu-block <qemu-block@nongnu.org>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"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 19:56:56 +0200	[thread overview]
Message-ID: <CAPan3Wp2KBj9i3k4jVj2hQvVBQyKP42KysBj0h_0VQbRMnWBOA@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8em-bgU2xd8OG+bPLDCSZCF8Y2ay9U57D8p9m1SWO=9g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2053 bytes --]

On Thu, Jul 9, 2020 at 4:15 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> 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?
>

Yeah good point Peter, I see what you mean. As I wrote to Philippe,
i'll try to make a small patch with some instructions in the OrangePi board
documentation,
so then we'll at least have something there to help the user.

Regards,
Niek


>
> thanks
> -- PMM
>


-- 
Niek Linnenbank

[-- Attachment #2: Type: text/html, Size: 3008 bytes --]

  parent reply	other threads:[~2020-07-09 17:58 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
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 [this message]
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=CAPan3Wp2KBj9i3k4jVj2hQvVBQyKP42KysBj0h_0VQbRMnWBOA@mail.gmail.com \
    --to=nieklinnenbank@gmail.com \
    --cc=alistair23@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.