mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
shadPS4: tolerate guard holes in FEX mapping checks; cache CI builds
Need for Speed Hot Pursuit Remastered stopped when a game thread's
destructors ran: the FEX engine's pre-flight check read /proc/self/maps
and required every page of the thread's writable range to be host-
writable, but the game keeps a PROT_NONE guard hole inside it
("host_permissions=---p", "pthread thread dtors failed at stage 1: 13").
Skip such holes; read-only or W+X pages still fail the check.
The build now compiles through ccache and keeps apt's downloads, both in
the workspace and carried between runs with actions/cache, so a rebuild
with the same pin recompiles only what a patch touched.
This commit is contained in:
1 parent
d0c6998b00
commit
fcbbe87dde
3 files changed
+46
-1
No files matched your search
@@ -10,13 +10,21 @@ cd "$WORK"
|
||||
. tools/shadps4/source.env
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
# Downloaded packages are kept in the workspace (.apt-cache), which the workflow caches between
|
||||
# runs; the image's docker-clean hook would otherwise delete them after every install.
|
||||
rm -f /etc/apt/apt.conf.d/docker-clean
|
||||
mkdir -p "$WORK/.apt-cache/archives/partial"
|
||||
cat > /etc/apt/apt.conf.d/99droiddeck-cache <<'APT'
|
||||
Dir::Cache::archives "/work/.apt-cache/archives";
|
||||
Binary::apt::APT::Keep-Downloaded-Packages "true";
|
||||
APT
|
||||
dpkg --add-architecture arm64
|
||||
apt-get update
|
||||
# The Bachata runtime's cross set, plus PulseAudio and ALSA headers so SDL3 builds its audio
|
||||
# drivers (it loads them at run time; the runtime plays through PulseAudio), and the Wayland, EGL
|
||||
# and xkbcommon headers with the host's wayland-scanner so it builds its Wayland video driver.
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates git curl xz-utils zstd file pkg-config dpkg-dev squashfs-tools \
|
||||
ca-certificates git curl xz-utils zstd file pkg-config dpkg-dev squashfs-tools ccache \
|
||||
cmake ninja-build clang llvm lld gcc g++ make \
|
||||
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu \
|
||||
python3 nodejs \
|
||||
@@ -45,7 +53,14 @@ done
|
||||
# only through it, and without it builds ALSA alone.
|
||||
export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
|
||||
pkg-config --modversion libpulse
|
||||
# Every CMake project the build configures (FEXCore, shadPS4 and its externals) compiles through
|
||||
# ccache; the cache lives in the workspace (.ccache) and the workflow keeps it between runs.
|
||||
export CCACHE_DIR=$WORK/.ccache CCACHE_BASEDIR=$WORK CCACHE_NOHASHDIR=1 \
|
||||
CCACHE_COMPILERCHECK=content CCACHE_MAXSIZE=4G \
|
||||
CMAKE_C_COMPILER_LAUNCHER=ccache CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
ccache -z
|
||||
bash "$SRC/runtime/scripts/build-shadps4-arm64.sh"
|
||||
ccache -s
|
||||
BIN=$SRC/runtime/build/shadps4-arm64-stage/bin/shadps4-arm64
|
||||
test -x "$BIN"
|
||||
cat "$SRC/runtime/build/shadps4-arm64-stage/needed.txt"
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/src/core/fex/fex_guest_engine.cpp b/src/core/fex/fex_guest_engine.cpp
|
||||
index 2271f97..71ddc6d 100644
|
||||
--- a/src/core/fex/fex_guest_engine.cpp
|
||||
+++ b/src/core/fex/fex_guest_engine.cpp
|
||||
@@ -182,7 +182,10 @@ EngineResult<bool> ValidateHostMapping(const GuestExecutionRange& range) {
|
||||
static_cast<unsigned long>(begin), static_cast<unsigned long>(end), permissions);
|
||||
return Failure(EngineStage::Mapping, EACCES);
|
||||
}
|
||||
- if (range.Writable && (permissions[1] != 'w' || permissions[2] == 'x')) {
|
||||
+ // A guard hole the guest protected itself (PROT_NONE, "---p") inside a writable range is
|
||||
+ // the game's own doing, like a stack guard page; FEX never writes there on its behalf.
|
||||
+ const bool guardHole = permissions[0] == '-' && permissions[1] == '-' && permissions[2] == '-';
|
||||
+ if (range.Writable && !guardHole && (permissions[1] != 'w' || permissions[2] == 'x')) {
|
||||
std::fprintf(stderr,
|
||||
"BACHATA_FEX_MAPPING_FAIL reason=host_write_permission error=%d begin=%#lx "
|
||||
"size=%#lx executable=%d writable=%d host_begin=%#lx host_end=%#lx "
|
||||
Reference in new issue
Block a user