Android security tags, read closely by Lightrion

CVE-2023-40131 AI-generated analysis

platform/frameworks/native, services/gpuservice (GpuService)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (3 corrections). Verify against the commit before relying on it.

Converts the two detached async-initialization threads spawned in the GpuService constructor into owned std::thread members and adds a GpuService destructor that joins them, so the threads can no longer run against a destroyed GpuService object.

Root cause

In services/gpuservice/GpuService.cpp, GpuService::GpuService() created two std::thread objects (gpuMemAsyncInitThread and gpuWorkAsyncInitThread) whose lambdas captured `this` and dereferenced members (mGpuMem->initialize(), mGpuMemTracer->initialize(mGpuMem), mGpuWork->initialize()), then immediately called detach() on both. Nothing tied the lifetime of those threads to the GpuService object, so if the GpuService was destroyed (last sp<> reference dropped) before the initializers finished, the threads could access freed memory. The commit message states this heap-use-after-free was reported by libfuzzer.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to October 2023 · Findings