[Bug 273573] emulators/pcsx2: unbreak with kern.elf64.allow_wx=0

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 05 Sep 2023 02:03:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273573

            Bug ID: 273573
           Summary: emulators/pcsx2: unbreak with kern.elf64.allow_wx=0
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: martymac@FreeBSD.org
          Reporter: jbeich@FreeBSD.org
          Assignee: martymac@FreeBSD.org
             Flags: maintainer-feedback?(martymac@FreeBSD.org)

Created attachment 244646
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=244646&action=edit
v1 (apply via "git am")

$ sysctl kern.elf64.allow_wx=0
$ pcsx2-qt
[...]
Video Dumping Directory: /home/foo/.config/PCSX2/videos
Segmentation fault

Process 52821 stopped
* thread #7, name = 'CPU Thread', stop reason = signal SIGSEGV: invalid address
(fault address: 0xe4edae0)
    frame #0: 0x000000082c29c41d
libthr.so.3`check_and_init_mutex(mutex=0x000000000e4edae0,
m=0x000000086944ba40) at thr_mutex.c:597:7
   594  {
   595          int ret;
   596
-> 597          *m = *mutex;
   598          ret = 0;
   599          if (*m == THR_PSHARED_PTR) {
   600                  *m = __thr_pshared_offpage(mutex, 0);
(lldb) bt
* thread #7, name = 'CPU Thread', stop reason = signal SIGSEGV: invalid address
(fault address: 0xe4edae0)
  * frame #0: 0x000000082c29c41d
libthr.so.3`check_and_init_mutex(mutex=0x000000000e4edae0,
m=0x000000086944ba40) at thr_mutex.c:597:7
    frame #1: 0x000000082c29bb86
libthr.so.3`__Tthr_mutex_lock(mutex=0x000000000e4edae0) at thr_mutex.c:753:8
    frame #2: 0x000000082ea37289 libc++.so.1`std::__1::mutex::lock() [inlined]
std::__1::__libcpp_mutex_lock(__m=<unavailable>) at __threading_support:303:10
    frame #3: 0x000000082ea37284
libc++.so.1`std::__1::mutex::lock(this=<unavailable>) at mutex.cpp:33:14
    frame #4: 0x0000000000a2edc7
pcsx2-qt`std::__1::unique_lock<std::__1::mutex>::unique_lock(this=0x000000086944bcc0,
__m=0x000000000e4edae0) at __mutex_base:119:61
    frame #5: 0x00000000011824fa
pcsx2-qt`pxOnAssertFail(file="/wrkdirs/usr/ports/emulators/pcsx2/work/pcsx2-1.7.4970/pcsx2/System.cpp",
line=181, func="VirtualMemoryManagerPtr makeMemoryManager(const char *, const
char *, size_t, size_t)", msg="Failed to find a good place for the memory
allocation, recompilers may fail") at Assertions.cpp:95:19
    frame #6: 0x0000000000b2dcce pcsx2-qt`makeMemoryManager(name="Code Memory
Manager", file_mapping_name=0x0000000000000000, size=319815680,
offset_from_base=335544320) at System.cpp:181:3
    frame #7: 0x0000000000b2d9e2
pcsx2-qt`SysMainMemory::SysMainMemory(this=0x000018692aa24000) at
System.cpp:191:17
    frame #8: 0x0000000000b53ead
pcsx2-qt`std::__1::__unique_if<SysMainMemory>::__unique_single
std::__1::make_unique<SysMainMemory>() at unique_ptr.h:725:32
    frame #9: 0x0000000000b4545a
pcsx2-qt`VMManager::Internal::CPUThreadInitialize() at VMManager.cpp:347:16
    frame #10: 0x00000000007afa74
pcsx2-qt`EmuThread::run(this=0x0000186924a11520) at QtHost.cpp:377:7
    frame #11: 0x000000082fbce5f5
libQt6Core.so.6`QThreadPrivate::start(this=0x000000086944bf68)::$_0::operator()()
const at qthread_unix.cpp:321:14
    frame #12: 0x000000082fbcd05d libQt6Core.so.6`void (anonymous
namespace)::terminate_on_exception<QThreadPrivate::start(t=0x000000086944bf68)::$_0>(QThreadPrivate::start(void*)::$_0&&)
at qthread_unix.cpp:257:9
    frame #13: 0x000000082fbccfbd
libQt6Core.so.6`QThreadPrivate::start(arg=0x0000186924a11520) at
qthread_unix.cpp:280:5
    frame #14: 0x000000082c297a7a
libthr.so.3`thread_start(curthread=0x0000186924a13500) at thr_create.c:292:16
(lldb) f 6
frame #6: 0x0000000000b2dcce pcsx2-qt`makeMemoryManager(name="Code Memory
Manager", file_mapping_name=0x0000000000000000, size=319815680,
offset_from_base=335544320) at System.cpp:181:3
   178          // If it's i386 anything can reach anything so it doesn't
matter
   179          if (sizeof(void*) == 8)
   180          {
-> 181                  pxAssertRel(0, "Failed to find a good place for the
memory allocation, recompilers may fail");
   182          }
   183          return std::make_shared<VirtualMemoryManager>(name,
file_mapping_name, 0, size);
   184  }

-- 
You are receiving this mail because:
You are the assignee for the bug.