In the Linux kernel, the following vulnerability has been resolved:
drm/xe: fix NPD in bomeminfo()
When a buffer object is purged, its ttm.resource is set to NULL via the TTM pipeline gutting flow. However, the BO remains in the client's object list until userspace explicitly closes the GEM handle. If memory stats are queried during this time, accessing bo->ttm.resource->memtype will result in a NULL pointer dereference.
Fix this by safely skipping purged BOs in bomeminfo, as they no longer consume any memory.
User is getting NPD on device resume, and possible theory is that in bomove(), if we need to evict something to SYSTEM to save the CCS state, but the BO is marked as dontneed, this won't trigger a move but will nuke the pages, leaving us with a NULL bo resource. And the meminfo() doesn't look ready to handle a NULL resource.
v2 (Sashiko): - There could potentially be other cases where we might end up with a NULL resource, so make this a general NULL check for now.
(cherry picked from commit c9a8e7daa0afe3161111e27fd92176e608c7f186)
In the Linux kernel, the following vulnerability has been resolved:
drm/xe: Add bounds check on patindex to prevent OOB kernel read in madvise
When user provides a bogus patindex value through the madvise IOCTL, the xepatindexgetcohmode() function performs an array access without validating bounds. This allows a malicious user to trigger an out-of-bounds kernel read from the xe->pat.table array.
The vulnerability exists because the validation in madviseargsaresane() directly calls xepatindexgetcohmode(xe, args->patindex.val) without first checking if patindex is within [0, xe->pat.nentries).
Although xepatindexgetcohmode() has a WARNON to catch this in debug builds, it still performs the unsafe array access in production kernels.
v2(Matthew Auld) - Using arrayindexnospec() to mitigate spectre attacks when the value is used
v3(Matthew Auld) - Put the declarations at the start of the block
(cherry picked from commit 944a3329b05510d55c69c2ef455136e2fc02de29)