summaryrefslogtreecommitdiff
path: root/Xext/shmint.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-11-03 13:12:40 -0800
committerKeith Packard <keithp@keithp.com>2013-11-11 15:16:07 -0800
commit41da295eb50fa08eaacd0ecde99f43a716fcb41a (patch)
tree27cffe15843774f40a4f3f494952c4a86a56151d /Xext/shmint.h
parent719e880d7698d92f9b854b217ef9680aaa446f2e (diff)
Trap SIGBUS to handle truncated shared memory segments
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 <keithp@keithp.com> v2: Use MAP_FIXED to simplify the recovery logic (Mark Kettenis) v3: Also catch errors in ShmCreateSegment Conflicts: include/dix-config.h.in include/xorg-config.h.in
Diffstat (limited to 'Xext/shmint.h')
-rw-r--r--Xext/shmint.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Xext/shmint.h b/Xext/shmint.h
index 7b3ea9bab..21d6cc4ee 100644
--- a/Xext/shmint.h
+++ b/Xext/shmint.h
@@ -62,6 +62,10 @@ typedef struct _ShmFuncs {
#define SHM_FD_PASSING 1
#endif
+#ifdef SHM_FD_PASSING
+#include "busfault.h"
+#endif
+
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
@@ -71,6 +75,7 @@ typedef struct _ShmDesc {
unsigned long size;
#ifdef SHM_FD_PASSING
Bool is_fd;
+ struct busfault *busfault;
XID resource;
#endif
} ShmDescRec, *ShmDescPtr;