Bug 261173 - emulators/rpcs3: set wxneeded ELF flag
Summary: emulators/rpcs3: set wxneeded ELF flag
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2022-01-13 11:51 UTC by Val Packett
Modified: 2022-04-01 18:41 UTC (History)
0 users

See Also:
jbeich: maintainer-feedback+


Attachments
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch (4.85 KB, patch)
2022-01-13 11:51 UTC, Val Packett
no flags Details | Diff
0001-emulators-rpcs3-set-wxneeded-ELF-flag.patch v2 (4.88 KB, patch)
2022-01-13 12:15 UTC, Val Packett
jbeich: maintainer-approval-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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(-)