Closed nullr0ute closed 5 years ago
Running GNOME Desktop as Wayland
Please report this to Eric Anholt, Boris Brezillon, dri-devel per mail.
There was a discussion about this and the conclusion was that we need to switch back to atomic_t. We lost track of the bug, it seems.
Hm, not sure this is the same issue here. A false positive has been fixed in vc4_bo_inc_usecnt() https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/drivers/gpu/drm/vc4?h=v4.15.7&id=5bfd40139d55790cbc8e56ad1ce4f974f1fa186d, but maybe this one is a real use after free issue.
I'll have a closer Look.
@nullr0ute, did you find an easy way to reproduce the problem?
I had a look at the code this morning and couldn't find a case where we could hit this problem. Everytime you attach a BO to a plane ->usecnt is incremented and everytime you detach it from the plane it is decremented, so assuming the ->prepare_fb()/->cleanup_fb() are balanced we shouldn't see this kind of issue.
I'll keep digging, but that'd be easier to debug if you have a way to reproduce the bug.
@anholt, looks like the async-plane-update path is not calling drm_atomichelper{prepare,cleanup}_planes() which might explain why we get an inconsistent ->usecnt.
I don't and I've not seen it regularly on 4.16, although I have been traveling so my testing with GUI has been minimal, should be doing more RSN but 4.16/17 focused.
@nullr0ute Is this still reproducible with Fedora 29?
I think we can close it off, I don't remember seeing it, can always re-open.
On a Raspberry Pi 3 running Fedora 27 on ARMv7 32 bit I've seen this use after free. Not sure it it's reproducible but will keep an eye out as I test 4.15 more widely.
On the CMA note it's got 256Mb of CMA allocated: