mbox series

[0/3] Make it possible to compile the x86 binaries without FDC

Message ID 20240425184315.553329-1-thuth@redhat.com (mailing list archive)
Headers show
Series Make it possible to compile the x86 binaries without FDC | expand

Message

Thomas Huth April 25, 2024, 6:43 p.m. UTC
For downstream versions of QEMU, we'd like to be able to compile QEMU
without the FDC code included (since it's not required for modern VMs
anymore and the FDC code has rather a bad reputation, see the VENOM CVE).

The q35 machine can already be instantiated without FDC, but for being
able to link a binary without the FDC code, the Kconfig file needs some
tweaks and there are two spots in the pc code that directly call functions
from the FDC code - those need to be disabled via #ifdefs.

The third patch changes the i440fx and isapc machine types so that
they can work without the FDC device, too, in case it has not been
compiled into the binary. It's marked as RFC since I assume that the
FDC was originally a fix compononent of these motherboards, so I'm
unsure whether we should allow the disablement there. OTOH, it seems
to work fine, and the FDC is only disabled when it is not available
in the binary, so I hope this patch is fine, too.

Thomas Huth (3):
  hw/i386/pc: Allow to compile without CONFIG_FDC_ISA
  hw/i386/Kconfig: Allow to compile Q35 without FDC_ISA
  hw/i386: Add the possibility to use i440fx and isapc without FDC

 hw/i386/pc.c      | 13 +++++++++----
 hw/i386/pc_piix.c |  6 ++++--
 hw/i386/Kconfig   |  2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)

Comments

Philippe Mathieu-Daudé April 25, 2024, 8:56 p.m. UTC | #1
Hi Thomas,

On 25/4/24 20:43, Thomas Huth wrote:
> For downstream versions of QEMU, we'd like to be able to compile QEMU
> without the FDC code included (since it's not required for modern VMs
> anymore and the FDC code has rather a bad reputation, see the VENOM CVE).

IIRC you still need to keep the i440fx+piix machine DS due to
migration compatibility, right?

Are you able to migrate a VM booted with FDC to a non-FDC one?

> The q35 machine can already be instantiated without FDC, but for being
> able to link a binary without the FDC code, the Kconfig file needs some
> tweaks and there are two spots in the pc code that directly call functions
> from the FDC code - those need to be disabled via #ifdefs.

Is it useful to you to have q35 without FDC but i440fx+piix with?
Or are you removing it from i440fx+piix due to shared code with q35?

> The third patch changes the i440fx and isapc machine types so that
> they can work without the FDC device, too, in case it has not been
> compiled into the binary. It's marked as RFC since I assume that the
> FDC was originally a fix compononent of these motherboards, so I'm
> unsure whether we should allow the disablement there. OTOH, it seems
> to work fine, and the FDC is only disabled when it is not available
> in the binary, so I hope this patch is fine, too.
> 
> Thomas Huth (3):
>    hw/i386/pc: Allow to compile without CONFIG_FDC_ISA
>    hw/i386/Kconfig: Allow to compile Q35 without FDC_ISA
>    hw/i386: Add the possibility to use i440fx and isapc without FDC
> 
>   hw/i386/pc.c      | 13 +++++++++----
>   hw/i386/pc_piix.c |  6 ++++--
>   hw/i386/Kconfig   |  2 +-
>   3 files changed, 14 insertions(+), 7 deletions(-)
>
Thomas Huth April 26, 2024, 5:08 a.m. UTC | #2
On 25/04/2024 22.56, Philippe Mathieu-Daudé wrote:
> Hi Thomas,
> 
> On 25/4/24 20:43, Thomas Huth wrote:
>> For downstream versions of QEMU, we'd like to be able to compile QEMU
>> without the FDC code included (since it's not required for modern VMs
>> anymore and the FDC code has rather a bad reputation, see the VENOM CVE).
> 
> IIRC you still need to keep the i440fx+piix machine DS due to
> migration compatibility, right?
> 
> Are you able to migrate a VM booted with FDC to a non-FDC one?

Migration from a machine with FDC to one without is likely not possible. But 
that's also not the purpose of this series. It's about having the 
possibility to build a QEMU binary without FDC at all in case you don't have 
to support old machine types with FDC anymore.

>> The q35 machine can already be instantiated without FDC, but for being
>> able to link a binary without the FDC code, the Kconfig file needs some
>> tweaks and there are two spots in the pc code that directly call functions
>> from the FDC code - those need to be disabled via #ifdefs.
> 
> Is it useful to you to have q35 without FDC but i440fx+piix with?
> Or are you removing it from i440fx+piix due to shared code with q35?

I think it might get useful.

  Thomas
Kevin Wolf April 29, 2024, 10:31 a.m. UTC | #3
[ Cc: qemu-block ]

Am 25.04.2024 um 20:43 hat Thomas Huth geschrieben:
> For downstream versions of QEMU, we'd like to be able to compile QEMU
> without the FDC code included (since it's not required for modern VMs
> anymore and the FDC code has rather a bad reputation, see the VENOM CVE).
> 
> The q35 machine can already be instantiated without FDC, but for being
> able to link a binary without the FDC code, the Kconfig file needs some
> tweaks and there are two spots in the pc code that directly call functions
> from the FDC code - those need to be disabled via #ifdefs.
> 
> The third patch changes the i440fx and isapc machine types so that
> they can work without the FDC device, too, in case it has not been
> compiled into the binary. It's marked as RFC since I assume that the
> FDC was originally a fix compononent of these motherboards, so I'm
> unsure whether we should allow the disablement there. OTOH, it seems
> to work fine, and the FDC is only disabled when it is not available
> in the binary, so I hope this patch is fine, too.
> 
> Thomas Huth (3):
>   hw/i386/pc: Allow to compile without CONFIG_FDC_ISA
>   hw/i386/Kconfig: Allow to compile Q35 without FDC_ISA
>   hw/i386: Add the possibility to use i440fx and isapc without FDC
> 
>  hw/i386/pc.c      | 13 +++++++++----
>  hw/i386/pc_piix.c |  6 ++++--
>  hw/i386/Kconfig   |  2 +-
>  3 files changed, 14 insertions(+), 7 deletions(-)
> 
> -- 
> 2.44.0
> 
>
Philippe Mathieu-Daudé May 6, 2024, 2:27 p.m. UTC | #4
On 25/4/24 20:43, Thomas Huth wrote:

> Thomas Huth (3):
>    hw/i386/pc: Allow to compile without CONFIG_FDC_ISA
>    hw/i386/Kconfig: Allow to compile Q35 without FDC_ISA
>    hw/i386: Add the possibility to use i440fx and isapc without FDC

Series:
Acked-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Paolo Bonzini May 6, 2024, 3:59 p.m. UTC | #5
On Thu, Apr 25, 2024 at 8:43 PM Thomas Huth <thuth@redhat.com> wrote:
> OTOH, it seems
> to work fine, and the FDC is only disabled when it is not available
> in the binary, so I hope this patch is fine, too.

We do the same for parallel so i think it should be fine---definitely
for -nodefaults, and I'd say in general too.  The CMOS byte already
has a way to communicate no-floppy (0, see cmos_get_fd_drive_type).

Paolo