From b9ceb13058d55c560bd3350291fcd4167d71e698 Mon Sep 17 00:00:00 2001 From: David Fort Date: Wed, 5 Dec 2018 15:21:00 +0100 Subject: [PATCH] uwac: handle wl_seat with version >= 7 Starting at version 7, the wayland client is supposed to mmap the keymap as MAP_PRIVATE to prevent accidental or intentional modifications. --- uwac/libuwac/uwac-input.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uwac/libuwac/uwac-input.c b/uwac/libuwac/uwac-input.c index ecb3b1a6c..16edb4b9b 100644 --- a/uwac/libuwac/uwac-input.c +++ b/uwac/libuwac/uwac-input.c @@ -66,6 +66,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, struct xkb_keymap *keymap; struct xkb_state *state; char *map_str; + int mapFlags = MAP_SHARED; if (!data) { close(fd); @@ -77,7 +78,10 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } - map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (input->seat_version >= 7) + mapFlags = MAP_PRIVATE; + + map_str = mmap(NULL, size, PROT_READ, mapFlags, fd, 0); if (map_str == MAP_FAILED) { close(fd); return;