Derek Foreman
2018-11-01 16:15:46 UTC
Weston commit 76829fc4eaea329d2a525c3978271e13bd76c078 (and similar
commits for other compositors) protects the compositor's keyboard
mapping from client damage by duplicating the keymap for every
client.
On some systems there are other potential fixes for this - such as
using sealed memfds on linux - but we can't use them since
essentially all client code anywhere has mapped the keyboard map
with a MAP_SHARED mmap() call.
While we can't break years worth of code, we can require any future
clients to use MAP_PRIVATE if they use a seat version above 6.
If a compositor can't use sealing or a similar facility, it should
still protect itself with copied keymaps, but clients must always
assume shared mapping of a keymap will fail.
Signed-off-by: Derek Foreman <***@gmail.com>
---
protocol/wayland.xml | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 141038b..802d433 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -1660,7 +1660,7 @@
</request>
</interface>
- <interface name="wl_seat" version="6">
+ <interface name="wl_seat" version="7">
<description summary="group of input devices">
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
@@ -1769,7 +1769,7 @@
</interface>
- <interface name="wl_pointer" version="6">
+ <interface name="wl_pointer" version="7">
<description summary="pointer input device">
The wl_pointer interface represents one or more input devices,
such as mice, which control the pointer location and pointer_focus
@@ -2092,7 +2092,7 @@
</event>
</interface>
- <interface name="wl_keyboard" version="6">
+ <interface name="wl_keyboard" version="7">
<description summary="keyboard input device">
The wl_keyboard interface represents one or more keyboards
associated with a seat.
@@ -2113,6 +2113,9 @@
<description summary="keyboard mapping">
This event provides a file descriptor to the client which can be
memory-mapped to provide a keyboard mapping description.
+
+ From version 7 onwards, the fd must be mapped with MAP_PRIVATE by
+ the recipient, as MAP_SHARED may fail.
</description>
<arg name="format" type="uint" enum="keymap_format" summary="keymap format"/>
<arg name="fd" type="fd" summary="keymap file descriptor"/>
@@ -2203,7 +2206,7 @@
</event>
</interface>
- <interface name="wl_touch" version="6">
+ <interface name="wl_touch" version="7">
<description summary="touchscreen input device">
The wl_touch interface represents a touchscreen
associated with a seat.
commits for other compositors) protects the compositor's keyboard
mapping from client damage by duplicating the keymap for every
client.
On some systems there are other potential fixes for this - such as
using sealed memfds on linux - but we can't use them since
essentially all client code anywhere has mapped the keyboard map
with a MAP_SHARED mmap() call.
While we can't break years worth of code, we can require any future
clients to use MAP_PRIVATE if they use a seat version above 6.
If a compositor can't use sealing or a similar facility, it should
still protect itself with copied keymaps, but clients must always
assume shared mapping of a keymap will fail.
Signed-off-by: Derek Foreman <***@gmail.com>
---
protocol/wayland.xml | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 141038b..802d433 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -1660,7 +1660,7 @@
</request>
</interface>
- <interface name="wl_seat" version="6">
+ <interface name="wl_seat" version="7">
<description summary="group of input devices">
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
@@ -1769,7 +1769,7 @@
</interface>
- <interface name="wl_pointer" version="6">
+ <interface name="wl_pointer" version="7">
<description summary="pointer input device">
The wl_pointer interface represents one or more input devices,
such as mice, which control the pointer location and pointer_focus
@@ -2092,7 +2092,7 @@
</event>
</interface>
- <interface name="wl_keyboard" version="6">
+ <interface name="wl_keyboard" version="7">
<description summary="keyboard input device">
The wl_keyboard interface represents one or more keyboards
associated with a seat.
@@ -2113,6 +2113,9 @@
<description summary="keyboard mapping">
This event provides a file descriptor to the client which can be
memory-mapped to provide a keyboard mapping description.
+
+ From version 7 onwards, the fd must be mapped with MAP_PRIVATE by
+ the recipient, as MAP_SHARED may fail.
</description>
<arg name="format" type="uint" enum="keymap_format" summary="keymap format"/>
<arg name="fd" type="fd" summary="keymap file descriptor"/>
@@ -2203,7 +2206,7 @@
</event>
</interface>
- <interface name="wl_touch" version="6">
+ <interface name="wl_touch" version="7">
<description summary="touchscreen input device">
The wl_touch interface represents a touchscreen
associated with a seat.
--
2.17.2
2.17.2