Repository navigation
drm/shmem: revoke CPU PFNs before releasing purge backing - #198
Merged
Merged
Conversation
Revocable CPU VMAs hold PFN mappings without ordinary rmap references. Dropping either the device page array or sparse CPU page references can make those pages reclaimable while a user PTE still names them. Mark the object purged and unmap all DRM VMAs, including the TLB invalidation, before releasing either array or clearing unevictable protection. This matches the existing idle-release ordering and covers both SG-first faults and sparse CPU backing. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Both GPU probe paths allocate a DRM device before creating the GPU manager. A successful no-op PinInit incorrectly claimed that AsahiData was initialized, so ordinary firmware, identity or allocation failures could run its destructor over uninitialized GPU and platform references. Add explicit two-phase allocation to the existing Rust DRM device. Keep the pinned data slot in UnsafeCell<MaybeUninit<_>> and publish destructor ownership only after the real initializer succeeds. Use a static allocation vtable while release state itself is uninitialized. Preserve the ordinary initialized constructor and inline workqueue offsets. Convert both Asahi probes to the explicit API, avoiding references to uninitialized data. Partial initializer failures unwind their own fields; post-initialization failures retain normal data destruction. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revocable CPU VMAs hold PFN mappings without ordinary rmap references.
Dropping either the device page array or sparse CPU page references can
make those pages reclaimable while a user PTE still names them. Mark
the object purged and unmap all DRM VMAs, including the TLB invalidation,
before releasing either array or clearing unevictable protection. This
matches the existing idle-release ordering and covers both SG-first
faults and sparse CPU backing.
Both GPU probe paths allocate a DRM device before creating the GPU
manager. A successful no-op PinInit incorrectly claimed that AsahiData
was initialized, so ordinary firmware, identity or allocation failures
could run its destructor over uninitialized GPU and platform references.
Add explicit two-phase allocation to the existing Rust DRM device. Keep
the pinned data slot in UnsafeCell<MaybeUninit<_>> and publish destructor
ownership only after the real initializer succeeds. Use a static
allocation vtable while release state itself is uninitialized. Preserve
the ordinary initialized constructor and inline workqueue offsets.
Convert both Asahi probes to the explicit API, avoiding references to
uninitialized data. Partial initializer failures unwind their own fields;
post-initialization failures retain normal data destruction.
Follow-up to #171; original contributor commits are preserved. These fixes are based on public Linux/PR source and Linux-side tests.
Validation: full arm64 Image, modules and DTB build passed; strict checkpatch passed for the final code changes with only the required Assisted-by trailer diagnostic excluded. Deterministic source-extracted regression tests passed, with the original implementation failing the relevant negative control.
Hardware qualification on aurora-edge is pending. No boot, suspend, fault-injection or firmware recovery pass is claimed. The publication gate is separate from runtime acceptance.
🤖 Generated with Claude Code