]> bbs.cooldavid.org Git - net-next-2.6.git/commit
drm/i915: Repeat unbinding during free if interrupted (v6)
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 23 Jul 2010 22:18:50 +0000 (23:18 +0100)
committerEric Anholt <eric@anholt.net>
Mon, 2 Aug 2010 02:53:24 +0000 (19:53 -0700)
commitbe72615bcf4d5b7b314d836c5e1b4baa4b65dad1
tree1a16cfaf29843b54a4577120c3c2df9cfd548f60
parentb09a1feca65764311f8a3e14befb52b98d705f0a
drm/i915: Repeat unbinding during free if interrupted (v6)

If during the freeing of an object the unbind is interrupted by a system
call, which is quite possible if we have outstanding GPU writes that
must be flushed, the unbind is silently aborted. This still leaves the
AGP region and backing pages allocated, and perhaps more importantly,
the object remains upon the various lists exposing us to memory
corruption.

I think this is the cause behind the use-after-free, such as

  Bug 15664 - Graphics hang and kernel backtrace when starting Azureus
              with Compiz enabled
  https://bugzilla.kernel.org/show_bug.cgi?id=15664

v2: Daniel Vetter reminded me that kernel space programming is never easy.
We cannot simply spin to clear the pending signal and so must deferred
the freeing of the object until later.
v3: Run from the top level retire requests.
v4: Tested with P(return -ERESTARTSYS)=.5 from i915_gem_do_wait_request()
v5: Rebase against Eric's for-linus tree.
v6: Refactor, split and add a comment about avoiding unbounded recursion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c