git: 023338f7d107 - main - emulators/wine-proton: Fix crash due to ASLR

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

URL: https://cgit.FreeBSD.org/ports/commit/?id=023338f7d107b80a8a40b6aadbcf7cccce0354f2

commit 023338f7d107b80a8a40b6aadbcf7cccce0354f2
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-07-24 21:14:23 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-07-24 21:14:23 +0000

    emulators/wine-proton:  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-proton/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/emulators/wine-proton/Makefile b/emulators/wine-proton/Makefile
index a648a13c545f..9ad4465e5310 100644
--- a/emulators/wine-proton/Makefile
+++ b/emulators/wine-proton/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	wine-proton
 DISTVERSION=	6.3-2
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	emulators
 
 MAINTAINER=	iwtcex@gmail.com
@@ -108,10 +108,12 @@ post-install:
 .if ${ARCH} == i386
 	${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wineserver ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wineserver32
 	${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine       ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine.bin
+	-${ELFCTL} -e +noaslr                                 ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine.bin
 	${INSTALL_SCRIPT} ${FILESDIR}/wine.sh                 ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine
 .else
 	${INSTALL_SCRIPT} ${FILESDIR}/pkg32.sh                ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/pkg32.sh
 	${MV} ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64     ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64.bin
+	-${ELFCTL} -e +noaslr                                 ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64.bin
 	${INSTALL_SCRIPT} ${FILESDIR}/wine.sh                 ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine64
 	${INSTALL_SCRIPT} ${FILESDIR}/wine-wow64.sh           ${STAGEDIR}${PREFIX}/${PORTNAME}/bin/wine
 .endif