Bug 261173

Summary: emulators/rpcs3: set wxneeded ELF flag
Product: Ports & Packages Reporter: Val Packett <val>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me Keywords: patch
Priority: --- Flags: jbeich: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch
none
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch v2 jbeich: maintainer-approval-

Description Val Packett 2022-01-13 11:51:12 UTC
Created attachment 230983 [details]
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch

RPCS3 doesn't support W^X, a "verification error" pops up on launch.

Hopefully the osversion check is fine
Comment 1 Val Packett 2022-01-13 12:15:44 UTC
Created attachment 230984 [details]
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch v2

err after the pre.mk
Comment 2 Jan Beich freebsd_committer freebsd_triage 2022-01-18 07:22:23 UTC
I can't reproduce on -CURRENT amd64. If W^X isn't enabled by default then better wait for a generic way to opt out of hardening features. Many emulators cannot handle W^X due to JIT e.g., ppsspp and yuzu-qt5 are also affected. Sometimes such issues can be fixed upstream e.g., ppsspp can enable PlatformIsWXExclusive() like OpenBSD.

Originally, ports 49f593b2f77f papered over an upstream bug exposed by ASLR. I just didn't have time to gather enough data and analyze to notify upstream.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2022-01-18 07:27:33 UTC
Comment on attachment 230984 [details]
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch v2

wxneeded does exist on FreeBSD 12.3, so OSVERSION check here introduces unnecessary complication just to support what will EOL after 2022-03-31.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-04-01 18:40:33 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0388b176339f5394663840bad25d8cdcfd283611

commit 0388b176339f5394663840bad25d8cdcfd283611
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2022-04-01 17:22:09 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-04-01 18:39:29 +0000

    emulators/rpcs3: unbreak with kern.elf64.allow_wx=0

    $ rpcs3
    Verification failed
    (in file rpcs3/util/vm_native.cpp:192[:3], in function memory_commit) (errno=13=Permission denied)
    Thread id = 0x814a12000.
    Killed

    PR:             261173
    Submitted by:   Greg V (based on)

 emulators/rpcs3/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)