[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqKyKUBOK7+fSpr+ShjUz72oXC91ySOKCST9WyWjd0nqww@mail.gmail.com>
Date: Fri, 6 Sep 2019 12:10:41 +0100
From: Rob Herring <robh@...nel.org>
To: Steven Price <steven.price@....com>
Cc: Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
dri-devel <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/panfrost: Prevent race when handling page fault
On Thu, Sep 5, 2019 at 1:11 PM Steven Price <steven.price@....com> wrote:
>
> When handling a GPU page fault addr_to_drm_mm_node() is used to
> translate the GPU address to a buffer object. However it is possible for
> the buffer object to be freed after the function has returned resulting
> in a use-after-free of the BO.
>
> Change addr_to_drm_mm_node to return the panfrost_gem_object with an
> extra reference on it, preventing the BO from being freed until after
> the page fault has been handled.
>
> Signed-off-by: Steven Price <steven.price@....com>
> ---
>
> I've managed to trigger this, generating the following stack trace.
Humm, the assumption was that a fault could only happen during a job
and so a reference would already be held. Otherwise, couldn't the GPU
also be accessing the BO after it is freed?
Also, looking at this again, I think we need to hold the mm_lock
around the drm_mm_for_each_node().
Rob
Powered by blists - more mailing lists