On Thu, 2013-11-07 at 12:15 -0800, Keith Packard wrote:
> If a client passes a section of memory via file descriptor and then
> subsequently truncates that file, the underlying pages will be freed
> and the addresses invalidated. Subsequent accesses to the page will
> fail with a SIGBUS error.
> 
> Trap that SIGBUS, figure out which segment was causing the error and
> then allocate new pages to fill in for that region. Mark the offending
> shared segment as invalid and free the resource ID so that the client
> will be able to tell when subsequently attempting to use the segment.
> 
> Signed-off-by: Keith Packard <[email protected]>
> 
> v2: Use MAP_FIXED to simplify the recovery logic (Mark Kettenis)
> v3: Also catch errors in ShmCreateSegment

I'm not totally convinced that you'd always get SIGBUS instead of
SIGSEGV?  Or anyway I don't feel like looking up the relevant specs atm.
But you'd crash in any case so this can't be worse.

Reviewed-by: Adam Jackson <[email protected]>

- ajax

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to