git: 116e5db78706 - main - emulators/wine: Fix crash due to ASLR

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Sun, 24 Jul 2022 21:15:07 UTC
The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/ports/commit/?id=116e5db787062c008379e8cd22b8896dd02ef758

commit 116e5db787062c008379e8cd22b8896dd02ef758
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-07-24 21:05:50 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-07-24 21:13:13 +0000

    emulators/wine: Fix crash due to ASLR
    
    ASLR has been enabled by default on -CURRENT and -STABLE and this
    causes Wine to crash. The clean solution would be to implement some
    memory mapping code that already exists for macOS and Linux, but this
    is not an essy task.
    
    In order to allow use of Wine on systems with ASLR mark the Wine
    executables as not compatible with ASLR using elfctl. This allows
    to keeps ASLR enabled on the system for all other binaries.
    
    If the required memory mapping functionality is made available, the
    elfctl commands should be removed from this and the other Wine ports.
    
    Approved by:    portmgr (implicit)
---
 emulators/wine/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/emulators/wine/Makefile b/emulators/wine/Makefile
index ca3084b3c4a9..880575b6029a 100644
--- a/emulators/wine/Makefile
+++ b/emulators/wine/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	wine
 DISTVERSION=	6.0.4
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	emulators
 MASTER_SITES=	SF/${PORTNAME}/Source \
@@ -158,9 +159,11 @@ post-install:
 .if ${ARCH} == i386
 	${MV} ${STAGEDIR}${PREFIX}/bin/wineserver   ${STAGEDIR}${PREFIX}/bin/wineserver32
 	${MV} ${STAGEDIR}${PREFIX}/bin/wine         ${STAGEDIR}${PREFIX}/bin/wine.bin
+	-${ELFCTL} -e +noaslr                       ${STAGEDIR}${PREFIX}/bin/wine.bin
 	${INSTALL_SCRIPT} ${FILESDIR}/wine.sh       ${STAGEDIR}${PREFIX}/bin/wine
 .else
 	${MV} ${STAGEDIR}${PREFIX}/bin/wine64       ${STAGEDIR}${PREFIX}/bin/wine64.bin
+	-${ELFCTL} -e +noaslr                       ${STAGEDIR}${PREFIX}/bin/wine64.bin
 	${INSTALL_SCRIPT} ${FILESDIR}/wine.sh       ${STAGEDIR}${PREFIX}/bin/wine64
 	${INSTALL_SCRIPT} ${FILESDIR}/wine-wow64.sh ${STAGEDIR}${PREFIX}/bin/wine
 	${INSTALL_SCRIPT} ${FILESDIR}/pkg32.sh      ${STAGEDIR}${DATADIR}/pkg32.sh