From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Leif Lindholm" <leif@nuviainc.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
"Radoslaw Biernacki" <rad@semihalf.com>
Subject: Re: [PATCH for-6.1] hw/arm/boot: Report error if there is no fw_cfg device in the machine
Date: Mon, 26 Jul 2021 13:08:00 -1000 [thread overview]
Message-ID: <4d166f7d-5bd9-54ce-21f6-91f39117ba98@linaro.org> (raw)
In-Reply-To: <20210726163351.32086-1-peter.maydell@linaro.org>
On 7/26/21 6:33 AM, Peter Maydell wrote:
> If the user provides both a BIOS/firmware image and also a guest
> kernel filename, arm_setup_firmware_boot() will pass the
> kernel image to the firmware via the fw_cfg device. However we
> weren't checking whether there really was a fw_cfg device present,
> and if there wasn't we would crash.
>
> This crash can be provoked with a command line such as
> qemu-system-aarch64 -M raspi3 -kernel /dev/null -bios /dev/null -display none
>
> It is currently only possible on the raspi3 machine, because unless
> the machine sets info->firmware_loaded we won't call
> arm_setup_firmware_boot(), and the only machines which set that are:
> * virt (has a fw-cfg device)
> * sbsa-ref (checks itself for kernel_filename && firmware_loaded)
> * raspi3 (crashes)
>
> But this is an unfortunate beartrap to leave for future machine
> model implementors, so we should handle this situation in boot.c.
>
> Check in arm_setup_firmware_boot() whether the fw-cfg device exists
> before trying to load files into it, and if it doesn't exist then
> exit with a hopefully helpful error message.
>
> Because we now handle this check in a machine-agnostic way, we
> can remove the check from sbsa-ref.
>
> Resolves:https://gitlab.com/qemu-project/qemu/-/issues/503
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2021-07-26 23:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 16:33 [PATCH for-6.1] hw/arm/boot: Report error if there is no fw_cfg device in the machine Peter Maydell
2021-07-26 23:08 ` Richard Henderson [this message]
2021-07-27 7:58 ` Philippe Mathieu-Daudé
2021-08-03 14:29 ` Leif Lindholm
2021-08-03 15:33 ` Peter Maydell
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=4d166f7d-5bd9-54ce-21f6-91f39117ba98@linaro.org \
--to=richard.henderson@linaro.org \
--cc=Andrew.Baumann@microsoft.com \
--cc=f4bug@amsat.org \
--cc=leif@nuviainc.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rad@semihalf.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).