The code that wasn’t there: Reading memory on an Android device by accident
A cache coherency flaw in the Qualcomm Adreno GPU driver meant that when user memory was mapped to the GPU, the GPU could read stale physical memory rather than the CPU-cached contents. An attacker with a malicious Android app could repeatedly leak user-space and kernel memory, enabling a KASLR bypass.
Published on github.blog
Man Yue Mo·@m-y-mo
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the KGSL driver assumed get_user_pages would flush the CPU cache, but on Arm64 flush_anon_page is a no-op and flush_dcache_page only marks pages dirty, so stale physical memory was exposed to the GPU.
Impact
A malicious Android app could leak user-space and kernel memory an unlimited number of times without crashing the phone, and the kernel leak could be used to bypass KASLR.
What the attacker needed
Malicious Android app on a Qualcomm device; access to the KGSL driver
The fix
The bug was fixed in the Android security patch after being disclosed in the Qualcomm bulletin.
How it was found
- Map a first buffer to the GPU and write the start of a write command near its end, then wait briefly.
- Map a second buffer in user space and then to the GPU so it sits next to the first buffer.
- Send the GPU command without delay so the GPU reads stale contents of the second buffer.
- Read the destination buffer to see the leaked data.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Modern processors keep recently used data in a small fast cache, and normally all parts of the system see the same copy. A graphics processor (GPU) reads memory directly and can miss data that is still only in the CPU cache, so it sees old contents. Here the driver forgot to flush that cache, letting an app read leftover memory from other processes and the kernel.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.