Skip to content

Commit e311a46

Browse files
txenoopelwell
authored andcommitted
drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size
commit 6395789 upstream. vc4_overflow_mem_work() points BPOA at a 512KB slot inside the 16MB binner BO, but writes the size of the whole BO to BPOS. On every binner out-of-memory event the PTB is therefore authorized to write tile lists across all the other slots (which may hold the tile state, tile alloc and overflow memory of in-flight jobs) and, for any slot but the first, past the end of the binner BO into unrelated CMA memory. Since CMA pages are recycled into page cache and user allocations, this is arbitrary memory corruption by GPU DMA. In practice it shows up as GPU hangs with corrupted control list pointers, userspace heap corruption, a GPU that stays permanently wedged after the first hang, and occasional full system crashes, whenever a job overflows the initial binner slot. The bug dates back to the conversion from a dedicated overflow BO (where writing the full BO size was correct) to the slotted binner BO. Fixes: 553c942 ("drm/vc4: Allow using more than 256MB of CMA memory.") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4.8 Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Reviewed-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20260727-vc4-bin-oom-fixes-v2-1-0d8a5eddc7c9@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
1 parent 3e4afe4 commit e311a46

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/vc4/vc4_irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ vc4_overflow_mem_work(struct work_struct *work)
104104
vc4->bin_alloc_overflow = BIT(bin_bo_slot);
105105

106106
V3D_WRITE(V3D_BPOA, bo->base.dma_addr + bin_bo_slot * vc4->bin_alloc_size);
107-
V3D_WRITE(V3D_BPOS, bo->base.base.size);
107+
V3D_WRITE(V3D_BPOS, vc4->bin_alloc_size);
108108
V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM);
109109
V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM);
110110
spin_unlock_irqrestore(&vc4->job_lock, irqflags);

0 commit comments

Comments
 (0)