Bug 381674 - wl_keyboard::keymap fd is shared and can be modified from any client
Summary: wl_keyboard::keymap fd is shared and can be modified from any client
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: git master
Platform: unspecified All
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-26 10:57 UTC by d138e196
Modified: 2020-03-19 14:04 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Minimal example that makes the keymap invalid (1.32 KB, text/x-csrc)
2017-06-26 10:57 UTC, d138e196
Details
Minimal example that makes the keymap invalid (1.33 KB, text/x-csrc)
2017-06-26 12:51 UTC, d138e196
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 2 David Edmundson 2020-03-17 17:26:59 UTC
Sorry for the delay, thanks for the investigation.

https://phabricator.kde.org/D28105
Comment 3 Vlad Zahorodnii 2020-03-19 14:04:20 UTC
Git commit 6bfa71d89aeec9bda402639118f09706d9985037 by Vlad Zahorodnii.
Committed on 19/03/2020 at 14:04.
Pushed by vladz into branch 'master'.

Pass a dedicated fd to each keyboard for the xkb  keymap

Summary:
To better isolate the clients from each other eachh KeyboardInterface
creates it's own dedicated temporary file and sends the fd for this
temporary file to the client. This means the memory for the keymap is no
longer shared between all clients, every client has an own copy.

To support this the existing API to set the keymap is deprecated and
replaced by a new method setKeymapData which takes the content of the
keymap as a byte array. The now deprecated method which takes a file
descriptor is changed to use the new setKeymapData method. For that it
reads the content of the file.

The implementation in KeyboardInterface to create the file descriptor is
based on the implementation of KWin. As I implemented the change in KWin
(see 3b4c508ee36ac74c37e77fcaa14d106397ad2994) it is not a problem from
GPL vs LGPL perspective.

The change includes test cases to verify that the content of the keymap
is properly passed to the client and that the memory is no longer shared.

Reviewers: #kwin, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, zzag

Subscribers: plasma-devel, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14910

M  +94   -2    autotests/client/test_wayland_seat.cpp
M  +1    -1    src/server/CMakeLists.txt
M  +26   -0    src/server/keyboard_interface.cpp
M  +1    -0    src/server/keyboard_interface.h
M  +3    -0    src/server/keyboard_interface_p.h
M  +26   -8    src/server/seat_interface.cpp
M  +22   -2    src/server/seat_interface.h
M  +1    -2    src/server/seat_interface_p.h

https://commits.kde.org/kwayland/6bfa71d89aeec9bda402639118f09706d9985037