From d9b691a00529f5d7a003111c2de3961ed9b60ad2 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 23 Feb 2022 15:07:32 -0500 Subject: [PATCH] Disable the non-KMS code so that we can enable the hardened build flags --- .xorg-x11-drv-vmware.metadata | 1 + ...-mustard-Disable-the-non-KMS-support.patch | 60 +++++++++++++++++++ 0001-mustard-fix-more-stdbool.patch | 19 ++++++ ...ader-inclusion-order-to-avoid-xorg-h.patch | 60 +++++++++++++++++++ xorg-x11-drv-vmware.spec | 16 ++++- 5 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 .xorg-x11-drv-vmware.metadata create mode 100644 0001-mustard-Disable-the-non-KMS-support.patch create mode 100644 0001-mustard-fix-more-stdbool.patch create mode 100644 0001-vmwgfx-Change-header-inclusion-order-to-avoid-xorg-h.patch diff --git a/.xorg-x11-drv-vmware.metadata b/.xorg-x11-drv-vmware.metadata new file mode 100644 index 0000000..85584c3 --- /dev/null +++ b/.xorg-x11-drv-vmware.metadata @@ -0,0 +1 @@ +eb4909a61bb45e1c88ea66f968bc79e55b1239c4 xf86-video-vmware-13.2.1.tar.bz2 diff --git a/0001-mustard-Disable-the-non-KMS-support.patch b/0001-mustard-Disable-the-non-KMS-support.patch new file mode 100644 index 0000000..4a3c10e --- /dev/null +++ b/0001-mustard-Disable-the-non-KMS-support.patch @@ -0,0 +1,60 @@ +From 515aad74707ed978b7ed3744d604b6520df18b3f Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 23 Feb 2022 14:39:43 -0500 +Subject: [PATCH xf86-video-vmware] mustard: Disable the non-KMS support + +We don't support it in RHEL and should never be able to hit this. That +part of the driver is the only part requiring vgahw or shadowfb symbols, +neither of which are present at module load time, so the #if 0 work here +keeps any of those symbol references from being linked into the final +driver, after which we can build this driver with full hardening +cflags. +--- + src/vmware.c | 2 ++ + src/vmware_bootstrap.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/vmware.c b/src/vmware.c +index 12f12ed..1f6007f 100644 +--- a/src/vmware.c ++++ b/src/vmware.c +@@ -1642,6 +1642,7 @@ VMWAREValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) + return MODE_OK; + } + ++#if 0 + void + vmwlegacy_hookup(ScrnInfoPtr pScrn) + { +@@ -1653,6 +1654,7 @@ vmwlegacy_hookup(ScrnInfoPtr pScrn) + pScrn->FreeScreen = VMWAREFreeScreen; + pScrn->ValidMode = VMWAREValidMode; + } ++#endif + + #ifdef XFree86LOADER + void +diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c +index d7ab070..30e6b86 100644 +--- a/src/vmware_bootstrap.c ++++ b/src/vmware_bootstrap.c +@@ -239,7 +239,6 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) + #else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Driver was compiled without KMS- and 3D support.\n"); +-#endif /* defined(BUILD_VMWGFX) */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling 3D support.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, +@@ -259,6 +258,8 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) + DEVICE_ID(pciInfo)); + + return (*pScrn->PreInit)(pScrn, flags); ++#endif /* defined(BUILD_VMWGFX) */ ++ return FALSE; + }; + + #if XSERVER_LIBPCIACCESS +-- +2.34.1 + diff --git a/0001-mustard-fix-more-stdbool.patch b/0001-mustard-fix-more-stdbool.patch new file mode 100644 index 0000000..a1278c5 --- /dev/null +++ b/0001-mustard-fix-more-stdbool.patch @@ -0,0 +1,19 @@ +diff -up xf86-video-vmware-13.2.1/vmwgfx/vmwgfx_output.c.jx xf86-video-vmware-13.2.1/vmwgfx/vmwgfx_output.c +--- xf86-video-vmware-13.2.1/vmwgfx/vmwgfx_output.c.jx 2016-11-15 23:06:33.000000000 -0500 ++++ xf86-video-vmware-13.2.1/vmwgfx/vmwgfx_output.c 2022-02-23 15:04:31.494921797 -0500 +@@ -33,7 +33,6 @@ + + #include "xorg-server.h" + #include +-#include + #include + #include + #include +@@ -48,6 +47,7 @@ + #endif + + #include "vmwgfx_driver.h" ++#include + + /** + * struct output_prop - Structure representing an output property. diff --git a/0001-vmwgfx-Change-header-inclusion-order-to-avoid-xorg-h.patch b/0001-vmwgfx-Change-header-inclusion-order-to-avoid-xorg-h.patch new file mode 100644 index 0000000..1faf32c --- /dev/null +++ b/0001-vmwgfx-Change-header-inclusion-order-to-avoid-xorg-h.patch @@ -0,0 +1,60 @@ +From 50ab008cb965dc9e47e0a84a1950e2485bbd3c44 Mon Sep 17 00:00:00 2001 +From: Martin Krastev +Date: Tue, 30 Nov 2021 11:47:39 -0800 +Subject: [PATCH xf86-video-vmware] vmwgfx: Change header inclusion order to + avoid xorg headers catching stdbool.h + +libdrm commit e641e2a632d779f638ac2ba983b9fceb20b3fac4 added +stdbool.h to the library headers which conflicts with xorg headers. + +Signed-off-by: Martin Krastev +Reviewed-by: Zack Rusin +Signed-off-by: Zack Rusin +--- + vmwgfx/vmwgfx_driver.h | 6 +++--- + vmwgfx/vmwgfx_saa.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h +index fa8e308..467fb21 100644 +--- a/vmwgfx/vmwgfx_driver.h ++++ b/vmwgfx/vmwgfx_driver.h +@@ -36,15 +36,15 @@ + #include + #include + #include +-#include +-#include +-#include + #include + #include + #include + #include + #include + #include ++#include ++#include ++#include + + #include "../src/compat-api.h" + #ifdef DRI2 +diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c +index 0881e2f..457f397 100644 +--- a/vmwgfx/vmwgfx_saa.c ++++ b/vmwgfx/vmwgfx_saa.c +@@ -29,11 +29,11 @@ + #include + #include + #include +-#include + #include + #include "vmwgfx_saa.h" + #include "vmwgfx_drmi.h" + #include "vmwgfx_saa_priv.h" ++#include + + /* + * Damage to be added as soon as we attach storage to the pixmap. +-- +2.34.1 + diff --git a/xorg-x11-drv-vmware.spec b/xorg-x11-drv-vmware.spec index b2b7852..003f8d2 100644 --- a/xorg-x11-drv-vmware.spec +++ b/xorg-x11-drv-vmware.spec @@ -4,8 +4,6 @@ #global gitdate 20150211 #global gitversion 8f0cf7c -%undefine _hardened_build - %if 0%{?gitdate} %global gver .%{gitdate}git%{gitversion} %endif @@ -13,7 +11,7 @@ Summary: Xorg X11 vmware video driver Name: xorg-x11-drv-vmware Version: 13.2.1 -Release: 17%{?gver}%{?dist} +Release: 18%{?gver}%{?dist} URL: http://www.x.org License: MIT @@ -25,6 +23,11 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2 Patch0: 0001-saa-Build-compatibility-with-xserver-1.20.patch +# 2044901 - annocheck FAIL: bind-now test (xorg-x11-drv-vmware) +Patch10: 0001-vmwgfx-Change-header-inclusion-order-to-avoid-xorg-h.patch +Patch11: 0001-mustard-fix-more-stdbool.patch +Patch12: 0001-mustard-Disable-the-non-KMS-support.patch + ExclusiveArch: %{ix86} x86_64 ia64 BuildRequires: make @@ -44,6 +47,9 @@ X.Org X11 vmware video driver. %prep %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}} %patch0 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 %build autoreconf -v --install || exit 1 @@ -62,6 +68,10 @@ find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f -- %{_mandir}/man4/vmware.4* %changelog +* Wed Feb 23 2022 Adam Jackson - 13.2.1-18 +- Disable the non-KMS code so that we can enable the hardened build flags + Resolves: rhbz#2044901 + * Tue Aug 10 2021 Mohan Boddu - 13.2.1-17 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688