diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-26 23:23:47 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-27 10:47:18 +0100 |
commit | 6ac1ac98c28d38b539f465c5ac488d879f1c2ab6 (patch) | |
tree | 449febdd0d44dc5fffa425e8ba65ee6bad3e610b /src/sna/sna_render.c | |
parent | 7025956558cfc391b553c9adb39d2a38fe494946 (diff) |
sna: Catch SIGBUS to prevent X death
We know that when we access either a CPU or GTT mmap we are vulernable
to receiving a SIGBUS. In fact, we can catch these and abort the
operation preventing X and all of its clients from randomly dieing.
This helps for instance if you try and use a 1GiB frontbuffer on a 2GiB
machine...
For complete protection, we also need to catch signals for all GTT maps,
such as VBO and staging buffers. (TBD)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render.c')
-rw-r--r-- | src/sna/sna_render.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 84275c43..73d53ba7 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -1676,11 +1676,14 @@ do_fixup: DBG(("%s: compositing tmp=(%d+%d, %d+%d)x(%d, %d)\n", __FUNCTION__, x, dx, y, dy, w, h)); - sna_image_composite(PictOpSrc, src, NULL, dst, - x + dx, y + dy, - 0, 0, - 0, 0, - w, h); + if (sigtrap_get() == 0) { + sna_image_composite(PictOpSrc, src, NULL, dst, + x + dx, y + dy, + 0, 0, + 0, 0, + w, h); + sigtrap_put(); + } free_pixman_pict(picture, src); /* Then convert to card format */ @@ -1883,11 +1886,14 @@ sna_render_picture_convert(struct sna *sna, return 0; } - pixman_image_composite(PictOpSrc, src, NULL, dst, - box.x1, box.y1, - 0, 0, - 0, 0, - w, h); + if (sigtrap_get() == 0) { + pixman_image_composite(PictOpSrc, src, NULL, dst, + box.x1, box.y1, + 0, 0, + 0, 0, + w, h); + sigtrap_put(); + } pixman_image_unref(dst); pixman_image_unref(src); } |