Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,71 @@ All notable changes to PS5Droid are documented here. The project follows
its honesty policy (docs/development.md, section 6): nothing in these
notes claims console execution that has not happened.

## [1.0.6] - 2026-11-21

### Added (Linux ABI surface, +15 syscalls)

The emulated surface grew from 46 to 57 syscalls, partial support from 4
to 8, and unsupported entries fell from 30 to 15 (80 tracked total):

* **Emulated:** `madvise`, `chdir`, `personality`, `sched_setaffinity`,
`sched_getaffinity`, `set_robust_list`, `wait4`, `exit`, `flock`,
`getdents64`, `memfd_create`.
* **Partial:** `mremap` (in-place shrink and `MREMAP_MAYMOVE` grow),
`arch_prctl` (FS/GS values recorded; no real TLS switch), `ioctl`
(`FIONREAD` only), `ppoll` (no signal-mask semantics).

### Added (Memory compatibility)

* **`mremap`** supports in-place shrink, `MREMAP_MAYMOVE` grow with
content preservation, and rejects non-movable growth with `ENOMEM`.
* **`madvise`** accepts `MADV_NORMAL`/`MADV_DONTNEED`; `MADV_DONTNEED`
zeroes anonymous private pages. Unknown advice returns `EINVAL`.

### Added (Guest fd table)

* **Directory streams (`getdents64`)** over the guest fd table, including
`.`/`..`, `O_DIRECTORY` enforcement, and EOF reporting.
* **`flock`** advisory locks with shared/exclusive/`LOCK_NB` semantics,
per-path ownership, and automatic release on close.
* **`memfd_create`** with `MFD_CLOEXEC`/`MFD_ALLOW_SEALING` flag
validation and full read/write/seek/fstat behavior.
* **`ppoll`/`poll`** readiness reporting for pipes, eventfds, and
`POLLNVAL` for closed descriptors.
* **`FIONREAD` ioctl** on file and memory-backed descriptors.

### Added (Guest filesystem view)

* **Tracked guest cwd.** `chdir` updates a normalized guest cwd, and
relative `open`, `openat`, `stat`, `newfstatat`, `access`, `mkdir`,
`unlink`, `readlink`, and `unlinkat` resolve against it.

### Fixed (APK inspection)

* **Dynamic-Huffman DEFLATE blocks.** The ZIP inflater now builds
canonical Huffman trees for the code-length, literal/length, and
distance alphabets, so real-world `AndroidManifest.xml` entries that
zlib emits as `BTYPE=2` are decoded. STORED and fixed-Huffman remain
supported; truncated/oversubscribed streams fail cleanly.

### Fixed (Bionic loader)

* **Initial stack layout.** `setup_initial_stack` now emits a real Linux
x86_64 stack: argc, argv/envp pointers into the same buffer, NULL
terminators, and auxv. `AT_PHDR` is derived from the `PT_LOAD` segment
covering `e_phoff` instead of the hardcoded `0x400000`.

### Changed (tests / docs / project)

* Added `tests/test_compat_debt.cpp` (mremap/madvise, chdir, personality,
arch_prctl, affinity, flock, memfd, getdents64, ppoll) plus
dynamic-Huffman DEFLATE and dynamic-AXML APK tests and a real-stack
bionic test. 80/80 tests pass on host.
* Compatibility counts are pinned by
`matrix_counts_match_v1_0_6_release`; README, architecture, and
platform-constraints docs now report 57/8/15.
* Version bumped to 1.0.6.

## [1.0.5] - 2026-10-22

### Added (Linux ABI surface, +4 syscalls)
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
cmake_minimum_required(VERSION 3.16)

project(ps5droid
VERSION 1.0.5
VERSION 1.0.6
DESCRIPTION "PS5Droid - native Android runtime research for PS5"
LANGUAGES C CXX)

Expand Down Expand Up @@ -103,6 +103,7 @@ if(PS5DROID_BUILD_TESTS AND PS5DROID_BUILD_HOST AND NOT PROSPERO)
tests/test_compat_dispatch.cpp
tests/test_compat_matrix.cpp
tests/test_compat_fs_syscalls.cpp
tests/test_compat_debt.cpp
tests/test_ipc_ring.cpp
tests/test_image_manager.cpp
tests/test_runtime_manager.cpp
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ Waydroid is used as an *architectural reference* only (see
code is imported. Low-level console facts come from the open-source
[ps5-payload-sdk](https://github.com/ps5-payload-dev/sdk) ecosystem.

## Current status (v1.0.5)
## Current status (v1.0.6)

| Area | Status |
|---|---|
| Portable platform layer (memory, threads, fs, IPC) | **Implemented and tested (host)** |
| Linux ABI dispatch experiment (guest fd table with Linux `O_*` flags, `fcntl`, `fsync`, readiness-based epoll/eventfd, guest pipes, mmap/brk/futex, path-stat family, writev, uname, prctl, getuid/getgid, getppid, set_tid_address, clock_nanosleep, getrandom) | **Implemented and tested (host)** |
| Compatibility matrix (80 syscalls: 46 emulated / 4 partial / 30 unsupported) | **Implemented and tested (host)** |
| Linux ABI dispatch experiment (guest fd table with Linux `O_*` flags, `fcntl`, `fsync`, readiness-based epoll/eventfd, guest pipes, mmap/brk/mremap/madvise, futex, path-stat family, guest cwd, directory streams, `flock`, `memfd_create`, `ppoll`, `FIONREAD`, writev, uname, prctl, getuid/getgid, getppid, set_tid_address, clock_nanosleep, getrandom) | **Implemented and tested (host)** |
| Compatibility matrix (80 syscalls: 57 emulated / 8 partial / 15 unsupported) | **Implemented and tested (host)** |
| Capability probes + runtime manager with structured blockers | **Implemented and tested (host)** |
| Android image manifest + SHA-256 + read-only ext4 superblock probe + build.prop parser | **Implemented and tested (host)** |
| APK inspection (binary AXML manifest parsing, ZIP entry extraction, native ABI detection, package name, app label, permissions & SDK levels) | **Implemented and tested (host)** |
| APK inspection (binary AXML manifest parsing, STORED/fixed/dynamic-Huffman DEFLATE, ZIP entry extraction, native ABI detection, package name, app label, permissions & SDK levels) | **Implemented and tested (host)** |
| Launcher UI model + 8x8 framebuffer font + shared screen builders | **Implemented and tested (host)** |
| Native PS5 payload (`ps5droid.elf`, video-out + pad + probe/status/matrix/about screens) | **Implemented, NOT tested on console** |
| PS5 PKG packaging | **Not implemented** (ELF-payload path only) |
| Linux binary loading / bionic re-hosting (Milestone 4) | **Implemented and tested (host)** |
| Linux binary loading / bionic re-hosting (Milestone 4, real argv/envp/auxv stack layout) | **Implemented and tested (host)** |
| Binder re-hosting (Milestone 5) | **Implemented and tested (host)** |
| Audio output | **Not implemented** (explicitly reported unsupported) |
| Vulkan / GPU-accelerated Android graphics | **Blocked** (no Vulkan driver for homebrew; proprietary AGC/GNM only) |
Expand All @@ -53,10 +53,13 @@ app/main.cpp (host CLI) app/ps5_main.cpp (PS5 payload)
the PS5 backend uses ps5-payload-sdk facilities with hand-maintained,
provenance-documented firmware declarations.
* **compat/** — accepts Linux x86_64 syscall numbers and executes an
honestly classified subset (anonymous memory, clocks, futex wait/wake,
a guest fd table with Linux `O_*` flag values, `fcntl`, `fsync`, guest pipes, readiness-based
epoll/eventfd, path stat family, writev, uname, prctl, getuid/getgid, getppid, set_tid_address, clock_nanosleep, getrandom); everything else
returns `-ENOSYS` with an explanation. The verified
honestly classified subset (anonymous memory with `mremap`/`madvise`,
clocks, futex wait/wake, a guest fd table with Linux `O_*` flag values,
`fcntl`, `fsync`, `flock`, guest pipes, directory streams, `memfd_create`,
`ppoll`, readiness-based epoll/eventfd, path stat family with a tracked
guest cwd, writev, uname, prctl, identity syscalls, `arch_prctl` bookkeeping,
affinity, set_tid_address/set_robust_list, clock_nanosleep, getrandom);
everything else returns `-ENOSYS` with an explanation. The verified
Linux→FreeBSD number mapping (e.g. mmap 9→477) is data in
`src/compat/linux_abi.h`.
* **android/** — image handling (manifest, SHA-256, ext4 superblock
Expand Down
56 changes: 36 additions & 20 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ src/
│ └── input_ps5.cpp scePad backend
├── compat/ Linux ABI experiment (Milestone 3+)
│ ├── linux_abi.h/.cpp syscall constants + tables + verified FreeBSD mapping
│ ├── memory_compat.cpp Linux brk + anonymous MAP_PRIVATE mmap semantics
│ ├── memory_compat.cpp Linux brk + anonymous MAP_PRIVATE mmap/mremap/madvise semantics
│ ├── fd_table.h/.cpp guest fd table: Linux O_* flags, lowest-free fds, guest pipes,
│ │ readiness-based epoll, eventfd (EFD_SEMAPHORE/overflow)
│ │ directory streams, memfd, flock, poll, readiness-based
│ │ epoll, eventfd (EFD_SEMAPHORE/overflow)
│ ├── syscall_dispatch.cpp Linux syscall number -> emulated op dispatch
│ ├── bionic_loader.cpp x86_64 ELF inspection + auxv/initial-stack builder
│ ├── bionic_loader.cpp x86_64 ELF inspection + real argv/envp/auxv stack builder
│ └── ipc_compat.cpp SPSC ring + Binder-style block allocator
├── android/
│ ├── sha256.cpp FIPS 180-4 (clean-room)
│ ├── image_manager.cpp manifest parsing + ext4 superblock + AXML parser + ZIP + build.prop
│ ├── image_manager.cpp manifest + ext4 probe + AXML + ZIP/DEFLATE (dynamic Huffman) + build.prop
│ ├── runtime_manager.cpp capability probes + honest start attempts
│ └── binder/
│ ├── binder_engine.h/.cpp in-process Binder RPC engine (Milestone 5)
Expand Down Expand Up @@ -101,24 +102,33 @@ numbers and executes a curated subset:
* `futex` WAIT/WAKE (private) over `platform::Futex` (registry-based,
wake-atomicity mirrors Linux's kernel-side check-and-enqueue);
* a **guest fd table** (`compat::CompatFdTable`) with Linux `O_*` flag
values, descriptor and status flag management via `fcntl`, `fsync` buffer synchronization, lowest-free fd allocation, `dup`/`dup2`/`dup3`, in-process guest pipes (`pipe2`),
values, descriptor and status flag management via `fcntl`, `fsync` buffer
synchronization, lowest-free fd allocation, `dup`/`dup2`/`dup3`,
in-process guest pipes (`pipe2`), directory streams (`getdents64`),
`memfd_create`, advisory `flock`, `poll`/`ppoll`, `FIONREAD` ioctl,
positioned `pread64` that never moves the shared offset, eventfd counters
honoring `EFD_SEMAPHORE` and the overflow ceiling, and `writev` gather output;
* **readiness-based epoll**: `epoll_ctl` enforces Linux `EEXIST`/
`ENOENT` semantics and `epoll_wait` reports only entries whose target
fd is currently ready (eventfd counters and pipes drive readiness);
* the path family `stat`/`newfstatat`/`unlinkat` (AT_FDCWD only), `access`,
`mkdir`, `unlink`, `readlink`, `getcwd` over host stat/stdio/symlink calls;
`mkdir`, `unlink`, `readlink`, `getcwd`, and `chdir` over host
stat/stdio/symlink calls, with a tracked guest cwd for relative paths;
* `uname` and `prctl` (process/thread naming);
* user and group identity (`getuid`, `getgid`, `geteuid`, `getegid`, `getppid` returning single-process guest identity) and thread id tracking (`set_tid_address`);
* user and group identity (`getuid`, `getgid`, `geteuid`, `getegid`, `getppid` returning single-process guest identity), thread id tracking (`set_tid_address`), `personality`, and `set_robust_list` registration;
* `arch_prctl` FS/GS bookkeeping (PARTIAL: no real TLS base switch) and
single-CPU `sched_setaffinity`/`sched_getaffinity`;
* `mremap` (PARTIAL: in-place shrink and MAYMOVE grow) and `madvise`
(`MADV_DONTNEED` zeroes anonymous private pages);
* `exit`/`wait4` under the no-child model (`wait4` returns `ECHILD`);
* high-resolution sleep (`nanosleep`, `clock_nanosleep`);
* `getrandom` (PARTIAL) from the host `/dev/urandom`;
* `write` to the process streams (fd 1/2);
* `exit_group` flags the context.

Everything else returns `-ENOSYS` with a *stable, explanatory note*
sourced from the syscall table. The matrix (46 emulated / 4 partial /
30 unsupported = 80 tracked at the v1.0.5 release) is data, not prose:
sourced from the syscall table. The matrix (57 emulated / 8 partial /
15 unsupported = 80 tracked at the v1.0.6 release) is data, not prose:
`ps5droid-host --matrix` prints it, tests pin the counts, and the
release documents repeat them.

Expand Down Expand Up @@ -175,17 +185,23 @@ documented in `development.md`; CI cross-builds the ELF on every push.
1. **M1 done** — host foundation, tests, CI, PS5 build path (ELF-only).
2. **M2 next** — run the same probes on a real console via elfldr and
fill the [ASSUMPTION] items in `platform-constraints.md`.
3. **M3 mostly done (v1.0.5)** — anonymous-memory subset, guest fd
table with Linux flag semantics, `fcntl`, `fsync`, guest pipes (`pipe2`), readiness-based
epoll/eventfd, `uname`, `prctl`, user/group/parent IDs (`getppid`), thread tracking (`set_tid_address`), `clock_nanosleep`, and path-stat family demonstrated end-to-end;
remaining: sockets, signals, directory streams, kqueue-backed poll on Orbis.
4. **M4 done at feasibility level** — bionic ELF inspection + auxv/
initial-stack construction tested on host; full dynamic linker
namespaces remain un-hosted.
3. **M3 mostly done (v1.0.6)** — anonymous-memory subset with
`mremap`/`madvise`, guest fd table with Linux flag semantics, `fcntl`,
`fsync`, `flock`, guest pipes (`pipe2`), directory streams
(`getdents64`), `memfd_create`, `poll`/`ppoll`, readiness-based
epoll/eventfd, `uname`, `prctl`, identity and affinity calls, thread
tracking (`set_tid_address`/`set_robust_list`), `clock_nanosleep`, and
the path-stat family plus `chdir` demonstrated end-to-end; remaining:
sockets, signals, and a kqueue-backed poll implementation on Orbis.
4. **M4 done at feasibility level** — bionic ELF inspection + real
argv/envp/auxv initial-stack construction (AT_PHDR derived from
PT_LOAD) tested on host; full dynamic linker namespaces remain
un-hosted.
5. **M5 done at engine level** — in-process Binder RPC engine
(handles, transactions, block-allocated buffers) tested on host; not
wire-compatible with the kernel protocol and never claiming to be.
6. **M6 done at inspection level (v1.0.5)** — APK structure probing (ZIP
extraction, binary AXML AndroidManifest parsing for package name, app label, permissions, SDK
levels, native library ABI extraction, DEX/native-lib presence); launch research waits on M4/M5 runtime
evidence.
6. **M6 done at inspection level (v1.0.6)** — APK structure probing (ZIP
extraction, STORED/fixed/dynamic-Huffman DEFLATE, binary AXML
AndroidManifest parsing for package name, app label, permissions, SDK
levels, native library ABI extraction, DEX/native-lib presence); launch
research waits on M4/M5 runtime evidence.
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development Guide

Current release: **v1.0.5** (see `CHANGELOG.md` and `src/version.h`).
Current release: **v1.0.6** (see `CHANGELOG.md` and `src/version.h`).

## 1. Repository layout

Expand Down
42 changes: 26 additions & 16 deletions docs/platform-constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,41 @@ Consequences (all encoded in `src/compat/linux_abi.h` and tested in
paths are a known risk. The compat layer returns `-ENOSYS` for the
signal family.

## 6. Linux ABI compatibility matrix (v1.0.5)
## 6. Linux ABI compatibility matrix (v1.0.6)

Authoritative live output: `./build/ps5droid-host --matrix`. Summary of
the 80 tracked syscalls:

* **EMULATED (46)** — real in-process behavior, unit tested:
memory (`mmap`, `brk`), clocks (`clock_gettime`, `clock_getres`,
`gettimeofday`, `nanosleep`, `clock_nanosleep`, `sched_yield`), identity
(`getpid`, `gettid`, `getuid`, `getgid`, `geteuid`, `getegid`, `getppid`), system & process (`uname`, `prctl`, `set_tid_address`), the guest fd table family (`read`, `write`,
`writev`, `open`, `openat`, `close`, `lseek`, `pread64`, `fstat`,
`dup`, `dup2`, `dup3`, `pipe2`, `fcntl`, `fsync`, `epoll_create1`, `epoll_ctl`, `epoll_wait`,
`eventfd2`), the path family (`stat`, `newfstatat`, `unlinkat`, `access`, `readlink`,
`mkdir`, `unlink`, `getcwd`), and `exit_group`
* **PARTIAL (4)** — implemented with documented restrictions:
* **EMULATED (57)** — real in-process behavior, unit tested:
memory (`mmap`, `brk`, `madvise`), clocks (`clock_gettime`,
`clock_getres`, `gettimeofday`, `nanosleep`, `clock_nanosleep`,
`sched_yield`), identity (`getpid`, `gettid`, `getuid`, `getgid`,
`geteuid`, `getegid`, `getppid`), system & process (`uname`, `prctl`,
`personality`, `set_tid_address`, `set_robust_list`,
`sched_setaffinity`, `sched_getaffinity`, `wait4`, `exit`,
`exit_group`), the guest fd table family (`read`, `write`, `writev`,
`open`, `openat`, `close`, `lseek`, `pread64`, `fstat`, `dup`, `dup2`,
`dup3`, `pipe2`, `fcntl`, `fsync`, `flock`, `getdents64`,
`memfd_create`, `epoll_create1`, `epoll_ctl`, `epoll_wait`,
`eventfd2`), the path family (`stat`, `newfstatat`, `unlinkat`,
`access`, `readlink`, `mkdir`, `unlink`, `getcwd`, `chdir`)
* **PARTIAL (8)** — implemented with documented restrictions:
`munmap` (whole mappings only), `mprotect` (R/W only; PROT_EXEC not
granted), `futex` (WAIT/WAKE + PRIVATE flag only), `getrandom`
(host `/dev/urandom`; pool distinction not modeled)
* **UNSUPPORTED (30)** — return `-ENOSYS` with an explanatory note. The
hard blockers remain `clone/fork/vfork/execve` (no process creation
for payloads), the socket and signal families, and directory streams.
granted), `mremap` (in-place shrink and `MREMAP_MAYMOVE` grow only),
`futex` (WAIT/WAKE + PRIVATE flag only), `getrandom` (host
`/dev/urandom`; pool distinction not modeled), `arch_prctl` (FS/GS
values recorded; no real TLS base switch), `ioctl` (`FIONREAD` only),
`ppoll` (readiness polling; no signal mask semantics)
* **UNSUPPORTED (15)** — return `-ENOSYS` with an explanatory note. The
hard blockers remain `clone/fork/vfork/execve` (no process creation for
payloads), the socket family (`socket`, `connect`, `accept`, `bind`,
`listen`), the signal family (`rt_sigaction`, `rt_sigprocmask`, `kill`,
`sigaltstack`, `tgkill`), and `inotify_init1`.

`getpid` returns the emulation-context id and `gettid` the platform
thread id — single-process model, documented in
`src/compat/syscall_dispatch.h`. The counts are pinned by
`tests/test_compat_matrix.cpp` (`matrix_counts_match_v1_0_5_release`)
`tests/test_compat_matrix.cpp` (`matrix_counts_match_v1_0_6_release`)
so docs and code cannot drift silently.

## 7. Filesystem
Expand Down
Loading
Loading