Skip to content

Commit 56e2c95

Browse files
committed
Detect image architecture from uname and fix 8.4.26 offset inventory
1 parent 67e73d6 commit 56e2c95

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎docs/offset-inventory.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ a build still needs heap calibration before the chain can run.
1313
| php:8.3.0-apache | 8.3.0 | arm64 | 0x3771f0 | 0x467cf0 | c1b72099fc8c | offsets extracted; heap not calibrated |
1414
| php:8.3.35-apache | 8.3.35 | arm64 | 0x377428 | 0x46fcc0 | 1f2bc20742e6 | offsets extracted; heap not calibrated |
1515
| php:8.4.25-apache | 8.4.25 | arm64 | 0x42fa30 | 0x637ae0 | 2d2388a4b0af | offsets extracted; heap not calibrated |
16-
| php:8.4.26-apache | 8.4.26 | arm64 | 0x465370 | 0x65eb60 | 51663cf883b1 | offsets extracted; heap not calibrated |
16+
| php:8.4.26-apache | 8.4.26 | amd64 | 0x465370 | 0x65eb60 | 51663cf883b1 | offsets extracted; heap not calibrated |
1717
| php:8.5.0-apache | 8.5.0 | arm64 | 0x503510 | 0x731d80 | 5910f3f12fbd | offsets extracted; heap not calibrated |
1818
| php:8.5.10-apache | 8.5.10 | arm64 | 0x52e130 | 0x75d360 | 5f080d44d3f8 | offsets extracted; heap not calibrated |
1919
| php:8.5.11-apache | 8.5.11 | arm64 | 0x5314f0 | 0x761b80 | 64a617aeb392 | offsets extracted; heap not calibrated |

‎profiles/offsets/8.4.26-amd64.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"image": "php:8.4.26-apache",
3+
"php_version": "8.4.26",
4+
"branch": "8.4",
5+
"arch": "amd64",
6+
"libphp": {
7+
"zif_system": "0x465370",
8+
"zval_ptr_dtor": "0x65eb60",
9+
"ps_globals": "0x1316820"
10+
},
11+
"libphp_sha256": "51663cf883b1223436d4c99f31dd0225735ea5573665e4242621eee7f4ee679c",
12+
"status": "offsets extracted; heap not calibrated"
13+
}

‎tools/php2shell_offsets.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ def image_env(image: str) -> dict:
125125

126126

127127
def image_arch(image: str) -> str:
128+
# Some imported/emulated images report an empty Architecture, so ask the
129+
# image itself. uname inside the container is authoritative.
130+
out = docker("run", "--rm", "--entrypoint", "uname", image, "-m", timeout=120)
131+
machine = out.stdout.strip().lower()
132+
if machine:
133+
mapped = {"aarch64": "arm64", "arm64": "arm64",
134+
"x86_64": "amd64", "amd64": "amd64"}.get(machine)
135+
if mapped:
136+
return mapped
128137
out = docker("inspect", "--format", "{{.Architecture}}", image)
129138
arch = out.stdout.strip()
130139
if not arch or arch == "unknown":

0 commit comments

Comments
 (0)