Gaining kernel code execution on an MTE-enabled Pixel 8
A logic bug in the Arm Mali GPU driver's JIT memory management allows a race condition where the GPU page fault handler grows a JIT region while the driver is resizing it, leading to stale size values and inconsistent GPU memory mappings. An attacker with a malicious Android app could exploit this to gain arbitrary kernel code execution and root on devices with newer Mali GPUs, bypassing MTE.
github.blog
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 a race condition: the driver drops a lock while growing a memory pool, allowing the GPU page fault handler to grow the same JIT region and change its backing page count, so cached size values become stale and are later used to allocate and map pages incorrectly.
Impact
A malicious Android app could gain arbitrary kernel code execution and root on affected devices, even with kernel MTE enabled, although MTE is disabled by default and requires extra steps to enable in the kernel.
What the attacker needed
Malicious Android app; device with Arm Mali GPU using CSF; MTE disabled by default (extra steps to enable)
The fix
The vulnerability was fixed in the Arm Mali driver version r47p0 and in the Android March security update.
How it was found
- Create a kbase_context by opening the Mali driver file and making ioctl calls.
- Create a kbase_kcpu_command_queue using the KBASE_IOCTL_KCPU_QUEUE_CREATE ioctl.
- Queue a JIT allocation command (BASE_KCPU_COMMAND_TYPE_JIT_ALLOC) to allocate JIT memory.
- Trigger kbase_jit_grow by requesting a larger physical size for an existing JIT region.
- While kbase_mem_pool_grow is running, access unmapped memory in the same JIT region from another thread to cause a GPU page fault.
- The fault handler grows the region, changing reg->gpu_alloc->nents and invalidating old_size and delta used later for allocation and mapping.
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.
This is a bug in the software that controls the phone's graphics chip (GPU). By carefully timing two actions, an attacker can confuse the driver about how much memory a GPU region has, which can lead to running their own code with the highest privileges on the phone. The bug is notable because it works even on a new phone with a strong memory protection feature called MTE.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.