Uh oh!
There was an error while loading. Please reload this page.
Strip ARM64 TBI tag byte from addresses before pread on /proc/<pid>/mem - #124709
Conversation
Android's scudo heap allocator uses ARM64 Top-Byte Ignore (TBI) to tag heap pointers with a non-zero top byte (e.g., 0xB4). While the CPU ignores this byte during memory access, pread on /proc/<pid>/mem treats the offset as a file position where TBI does not apply, causing EINVAL. Strip the top byte before pread in PAL_ReadProcessMemory and createdump's ReadProcessMemory. This is a no-op on non-Android ARM64 Linux today, but guards against future TBI/MTE adoption on other distributions. See https://www.kernel.org/doc/html/latest/arch/arm64/tagged-address-abi.html
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
This pull request addresses an issue with Android's scudo heap allocator, which uses ARM64 Top-Byte Ignore (TBI) to tag heap pointers. When reading process memory via pread on /proc/<pid>/mem, the kernel treats the offset as a file position rather than a virtual address, causing EINVAL errors for TBI-tagged pointers. The fix strips the top byte from addresses before calling pread.
Changes:
- Added TBI tag byte stripping in
PAL_ReadProcessMemoryfor non-Apple platforms - Added TBI tag byte stripping in createdump's
ReadProcessMemorybefore pread calls - Comprehensive comments explaining the Android scudo allocator issue and future-proofing for ARM MTE
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/pal/src/debug/debug.cpp | Strips TBI tag byte from addresses before pread in PAL_ReadProcessMemory for non-Apple platforms |
| src/coreclr/debug/createdump/crashinfounix.cpp | Strips TBI tag byte from addresses before pread in crash dump memory reading, guarded by TARGET_ARM64 |
Uh oh!
There was an error while loading. Please reload this page.
steveisok
commented
Feb 24, 2026
/ba-g Known issues and generic unrelated timeouts |
Uh oh!
There was an error while loading. Please reload this page.
…em (dotnet#124709) Android's scudo heap allocator uses ARM64 Top-Byte Ignore (TBI) to tag heap pointers with a non-zero top byte (e.g., 0xB4). While the CPU ignores this byte during memory access, pread on /proc/<pid>/mem treats the offset as a file position where TBI does not apply, causing EINVAL. Strip the top byte before pread in PAL_ReadProcessMemory and createdump's ReadProcessMemory. This is a no-op on non-Android ARM64 Linux today, but guards against future TBI/MTE adoption on other distributions. See https://www.kernel.org/doc/html/latest/arch/arm64/tagged-address-abi.html
Android's scudo heap allocator uses ARM64 Top-Byte Ignore (TBI) to tag heap pointers with a non-zero top byte (e.g., 0xB4). While the CPU ignores this byte during memory access, pread on /proc//mem treats the offset as a file position where TBI does not apply, causing EINVAL.
Strip the top byte before pread in PAL_ReadProcessMemory and createdump's ReadProcessMemory. This is a no-op on non-Android ARM64 Linux today, but guards against future TBI/MTE adoption on other distributions.
See https://www.kernel.org/doc/html/latest/arch/arm64/tagged-address-abi.html