Skip to content

Commit df387f0

Browse files
author
Hyper-Fumetsu
committed
Add ashmem autopsy results — 9 dead, 2 alive
1 parent 2bfca03 commit df387f0

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,44 @@ cc -std=c11 -o fallback_test test/fallback_test.c -I. -L. -landroid-shmem -llog
7575
LD_LIBRARY_PATH=. ./fallback_test
7676
# 🧪 Backend fallback test → ✅ 6/6 PASS
7777
```
78+
79+
## ashmem autopsy: Android 14 (kernel 5.10.226)
80+
81+
Full ioctl-level testing reveals that ashmem on modern Android kernels is a **zombie** — only the bare minimum allocation path survives:
82+
83+
### Alive
84+
| Feature | Status |
85+
|---------|:---:|
86+
| SET_SIZE (allocation) ||
87+
| mmap (R/W + R/O + SEGV guard) ||
88+
| 10 concurrent fds ||
89+
| 32MB large allocation ||
90+
91+
### Dead
92+
| Feature | Status |
93+
|---------|:---:|
94+
| SET\_NAME / GET\_NAME | 💀 ENOTTY |
95+
| GET\_SIZE | 💀 ENOTTY |
96+
| SET\_PROT\_MASK / GET\_PROT\_MASK | 💀 ENOTTY |
97+
| PIN / UNPIN | 💀 EINVAL |
98+
| GET\_PIN\_STATUS | 💀 ENOTTY |
99+
| PURGE\_ALL\_CACHES | 💀 ENOTTY |
100+
101+
### Bottom line
102+
103+
ashmem can allocate and map memory, but **every management function is dead**. You can't name a region, can't query its size, can't pin pages, can't purge caches, can't set protection masks. The kernel has deliberately gutted all advanced features, leaving only the minimal allocation path for legacy app compatibility.
104+
105+
memfd provides all of this — naming (`/proc/self/fd/N`), sizing (`fstat`), sealing (`F_SEAL_WRITE`), and more — with a single syscall and no device dependency.
106+
107+
## Memory comparison
108+
109+
| Feature | ashmem (Honor 5.10.226) | memfd |
110+
|---------|:---:|:---:|
111+
| Allocate | ✅ SET\_SIZE (32-bit compat) | ✅ ftruncate |
112+
| mmap R/W |||
113+
| Name | ❌ ENOTTY | ✅ /proc/self/fd/N |
114+
| Query size | ❌ ENOTTY | ✅ fstat |
115+
| Pin pages | ❌ EINVAL | ✅ via mlock |
116+
| Sealing || ✅ F\_SEAL\_\* |
117+
| SELinux shell access | ❌ EACCES ||
118+
| Cross-process via SCM_RIGHTS |||

0 commit comments

Comments
 (0)