Skip to contentSkip to conversation

disable building of pv-grub and qemu-trad per default

PATCH Superseded Juergen Gross 3 participants 11 messages Sep 9, 2021 – Sep 13, 2021 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover disable building of pv-grub and qemu-trad per default

This is a first step of deprecating pv-grub and qemu-trad including ioemu-stubdom. Switch the default to not building it.

Changes in V2:
- new patch 3
- added CHANGELOG.md entry in patch 2

Juergen Gross (3):
stubdom: fix build with disabled pv-grub
stubdom: disable building pv-grub
tools: disable building qemu-trad per default

 CHANGELOG.md         |  5 +++++
 Makefile             |  4 ++--
 stubdom/Makefile     | 13 +++++++++++++
 stubdom/configure    | 16 ++--------------
 stubdom/configure.ac | 10 ++--------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 7 files changed, 27 insertions(+), 51 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/3 stubdom: fix build with disabled pv-grub

Today the build will fail if --disable-pv-grub as a parameter of configure, as the main Makefile will unconditionally try to build a 32-bit pv-grub stubdom.

Fix that by introducing a pv-grub32 target in stubdom/Makefile taking care of this situation.

---
 Makefile         |  4 ++--
 stubdom/Makefile | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
Makefile +2 -2
index 96d32cfd50..5b5cef3e49 100644
@@ -72,7 +72,7 @@ build-tools-oxenstored: build-tools-public-headers
 build-stubdom: mini-os-dir build-tools-public-headers
 	$(MAKE) -C stubdom build
 ifeq (x86_64,$(XEN_TARGET_ARCH))
-	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
+	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub32
 endif
 
 .PHONY: build-docs
@@ -143,7 +143,7 @@ install-tools: install-tools-public-headers
 install-stubdom: mini-os-dir install-tools
 	$(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
-	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
+	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub32
 endif
 
 .PHONY: tools/firmware/seabios-dir-force-update
stubdom/Makefile +13 -0
index 06aa69d8bc..b339ae701c 100644
@@ -531,6 +531,13 @@ vtpmmgr-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpmmgr vtpmmgr
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
+.PHONY: pv-grub32
+ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
+pv-grub32: pv-grub
+else
+pv-grub32:
+endif
+
 .PHONY: xenstore-stubdom
 xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
@@ -560,6 +567,12 @@ install-grub: pv-grub
 	$(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
 	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-grub/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/pv-grub-$(XEN_TARGET_ARCH).gz"
 
+ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
+install-grub32: install-grub
+else
+install-grub32:
+endif
+
 install-c: c-stubdom
 
 install-caml: caml-stubdom
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Juergen Gross writes ("[PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 6 lines

Today the build will fail if --disable-pv-grub as a parameter of configure, as the main Makefile will unconditionally try to build a 32-bit pv-grub stubdom.

Fix that by introducing a pv-grub32 target in stubdom/Makefile taking care of this situation.

I approve of this whole series, with one resrvation:

I think the name "pv-grub32" for this target is confusing. It's not really specifically 32-bit. The difference between the targets "pv-grub32" and "pv-grub" is that "pv-grub32" is unconditionally built but might mean nothing; it has a conditional dependency on "pv-grub" which is conditionally built but always implies the actual build.

I don't think the suffix "32" really conveys this :-).

How about "pv-grub-maybe" ? Or something.

You can put my ack on patches 2 and 3 right away.

Thanks,
Ian.

#3 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Quoted 17 lines · Ian Jackson

Juergen Gross writes ("[PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 6 lines

Today the build will fail if --disable-pv-grub as a parameter of configure, as the main Makefile will unconditionally try to build a 32-bit pv-grub stubdom.

Fix that by introducing a pv-grub32 target in stubdom/Makefile taking care of this situation.

I approve of this whole series, with one resrvation:

I think the name "pv-grub32" for this target is confusing. It's not really specifically 32-bit. The difference between the targets "pv-grub32" and "pv-grub" is that "pv-grub32" is unconditionally built but might mean nothing; it has a conditional dependency on "pv-grub" which is conditionally built but always implies the actual build.

Quoted 3 lines

I don't think the suffix "32" really conveys this :-).

How about "pv-grub-maybe" ? Or something.

What about "pv-grub-if-enabled"?

And could that be done when committing, or should I send another round?

Quoted 2 lines

You can put my ack on patches 2 and 3 right away.

Thanks,

Juergen

#4 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Juergen Gross writes ("Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 4 lines · Ian Jackson
Quoted 1 line

How about "pv-grub-maybe" ? Or something.

What about "pv-grub-if-enabled"?

Fine by me.

Quoted 1 line

And could that be done when committing, or should I send another round?

Please do send another round (sorry).

Thanks,
Ian.

#5 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Quoted 11 lines · Ian Jackson

Juergen Gross writes ("Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 4 lines · Ian Jackson
Quoted 1 line

How about "pv-grub-maybe" ? Or something.

What about "pv-grub-if-enabled"?

Fine by me.

Quoted 1 line

And could that be done when committing, or should I send another round?

Please do send another round (sorry).

NP.

BTW, you probably want to modify OSStest to use configure with:

--enable-pv-grub --enable-qemu-traditional

in order to not let the tests fail (applies to x86 only, of course).

Juergen

#6 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Juergen Gross writes ("Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 5 lines

BTW, you probably want to modify OSStest to use configure with:

--enable-pv-grub --enable-qemu-traditional

in order to not let the tests fail (applies to x86 only, of course).

I think it might be better to disable those tests. What do people think ?

Ian.

#7 lore raw

Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub

Quoted 9 lines · Ian Jackson

Juergen Gross writes ("Re: [PATCH v2 1/3] stubdom: fix build with disabled pv-grub"):

Quoted 5 lines

BTW, you probably want to modify OSStest to use configure with:

--enable-pv-grub --enable-qemu-traditional

in order to not let the tests fail (applies to x86 only, of course).

I think it might be better to disable those tests. What do people think ?

Disabling pv-grub tests is okay (I think it happened already, right?).

Disabling qemu-trad tests with qemu running in dom0 is fine, too, IMO.

Disabling the stubdom tests is much more concerning, as there is quite some code in the tools which would be untested then.

Juergen

#8 lore raw

PATCH v2 2/3 stubdom: disable building pv-grub

In reply to Juergen Gross

The stubdom based pv-grub is using a very outdated version of grub (0.97) and should not be used any longer. Mainline grub has support for PV guests for a long time now, so that should be used as a boot loader of a PV domain.

So disable building pv-grub per default. In case someone really wants to continue using it he/she can still use a pv-grub binary from an older Xen version or manually enable building it via:

  configure --enable-pv-grub

---
V2:
- add CHANGELOG.md entry (Jan Beulich)

---
 CHANGELOG.md         | 2 ++
 stubdom/configure    | 8 ++------
 stubdom/configure.ac | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)
CHANGELOG.md +2 -0
index 22cfdb4298..e7107ac3de 100644
@@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    appearing in 4.12.2 and 4.11.4). Prior (4.13...4.15-like) behavior can be arranged for
    either by enabling the IOMMU_QUARANTINE_SCRATCH_PAGE setting at build (configuration) time
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
+ - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
+   configure needs to be called with "--enable-pv-grub" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
stubdom/configure +2 -6
index aa48df986d..df31532abb 100755
@@ -1342,7 +1342,7 @@ Optional Features:
   --enable-ioemu-stubdom  Build and install ioemu-stubdom
   --enable-c-stubdom      Build and install c-stubdom (default is DISABLED)
   --enable-caml-stubdom   Build and install caml-stubdom (default is DISABLED)
-  --disable-pv-grub       Build and install pv-grub (default is ENABLED)
+  --enable-pv-grub        Build and install pv-grub (default is DISABLED)
   --disable-xenstore-stubdom
                           Build and install xenstore-stubdom (default is
                           ENABLED)
@@ -2129,11 +2129,7 @@ fi
 else
 
 
-grub=y
-STUBDOM_TARGETS="$STUBDOM_TARGETS grub"
-STUBDOM_BUILD="$STUBDOM_BUILD pv-grub"
-STUBDOM_INSTALL="$STUBDOM_INSTALL install-grub"
-STUBDOM_UNINSTALL="$STUBDOM_UNINSTALL install-grub"
+grub=n
 
 
 fi
stubdom/configure.ac +1 -1
index bd6f765929..a07a1edae5 100644
@@ -21,7 +21,7 @@ m4_include([../m4/fetcher.m4])
 AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
 AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c])
 AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml])
-AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub])
+AX_STUBDOM_DEFAULT_DISABLE([pv-grub], [grub])
 AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])
 AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
Signature · 1 line
2.26.2
#9 lore raw

PATCH v2 3/3 tools: disable building qemu-trad per default

In reply to Juergen Gross

Using qemu-traditional as device model is deprecated for some time now.

So change the default for building it to "disable". This will affect ioemu-stubdom, too, as there is a direct dependency between the two.

Today it is possible to use a PVH/HVM Linux-based stubdom as device model. Additionally using ioemu-stubdom isn't really helping for security, as it requires to run a very old and potentially buggy qemu version in a PV domain. This is adding probably more security problems than it is removing by using a stubdom.

---
V2:
- new patch

---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)
CHANGELOG.md +3 -0
index e7107ac3de..e5ab49e779 100644
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
stubdom/configure +0 -8
index df31532abb..07b709f998 100755
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
stubdom/configure.ac +1 -7
index a07a1edae5..e20d99edac 100644
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
tools/configure +2 -15
index 33814b24b3..8bf8fe75b8 100755
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,19 +4287,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
tools/configure.ac +1 -12
index 6414fcbb44..a713fd34d6 100644
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
Signature · 1 line
2.26.2
Reviewed-by on v2 3/3
#10 lore raw

Re: [PATCH v2 3/3] tools: disable building qemu-trad per default

Juergen Gross, le jeu. 09 sept. 2021 14:49:24 +0200, a ecrit:

Quoted 5 lines

Using qemu-traditional as device model is deprecated for some time now.

So change the default for building it to "disable". This will affect ioemu-stubdom, too, as there is a direct dependency between the two.

Quoted 7 lines

Today it is possible to use a PVH/HVM Linux-based stubdom as device model. Additionally using ioemu-stubdom isn't really helping for security, as it requires to run a very old and potentially buggy qemu version in a PV domain. This is adding probably more security problems than it is removing by using a stubdom.

Quoted 125 lines

---
V2:
- new patch

---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)
CHANGELOG.md +3 -0
index e7107ac3de..e5ab49e779 100644
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
stubdom/configure +0 -8
index df31532abb..07b709f998 100755
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
stubdom/configure.ac +1 -7
index a07a1edae5..e20d99edac 100644
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
tools/configure +2 -15
index 33814b24b3..8bf8fe75b8 100755
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,19 +4287,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
tools/configure.ac +1 -12
index 6414fcbb44..a713fd34d6 100644
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
Signature · 1 line
2.26.2
Signature · 3 lines
Samuel
<A>  mr  -  remove the home of correct users who accidentally enter mr
<A>        instead of rm