Re: Bypass events and get the physical keyboard state directly
Bryan Baldwin <[email protected]>
| Newsgroups | gmane.linux.xdg.devel |
|---|---|
| Message-ID | <[email protected]> |
Yup, the encryption was an automagickal client mistake. And I understand all your points, and don't disagree with the security model. I just don't think that the people and the software that are assuming responsibility for system security should be. I'm not afraid to go and look, then tear it up and write my own thing if its a good use of time. I think its going to be a very good use of time these days ;) For posterity, the input problem I had is a bug in SDL2. Pressing and holding down a key was not producing events with the repeat flag set. It produced pairs of keydown & pressed - keyup & released events without the repeat flag set. These events continued to be send long after the key was physically released. It is an untenable expectation for the application to track key state with garbage input. This is a known SDL2 bug affecting at least verisons 2.0.4 https://bugzilla.libsdl.org/show_bug.cgi?id=3472 and 2.0.5. There is a patch I've tested locally on my own system, and it works. https://bugzilla-attachments.libsdl.org/attachment.cgi?id=2594 On 02/20/2017 11:17 PM, Pekka Paalanen wrote: > (I think you just sent an encrypted email to a mailing list. I assume > this was an accident, since nothing indicates otherwise.) > > > On Mon, 20 Feb 2017 21:56:03 +1300 > Bryan Baldwin <[email protected]> wrote: > >> I don't know why you mentioned Wayland. As a reference point? I'm not >> presently developing with a Wayland target. > Yes, as a reference point. > >> I cannot track the state of the keyboard with the events I received, >> because, as described, they are garbage. Something between evdev and >> my code screws the input data. X11, GNOME, or SDL2. Out of that >> stack, X11 would have been my goto to look for a way to view input >> more directly, which is why I asked about your interfaces here, but >> even that was completely wrong. > There is probably a reason why something somewhere converts repeats > into up/down pairs, if that is the only problem you have. You could try > finding out which component is responsible for it, and ask on the > appropriate mailing list why it is so and how to work around it. > > I would also hazard a guess that these up/down pairs come really close > to each other, so if you actually drained the event queue before > looking at the tracked keyboard state, maybe it would be what you need. > But that is just speculation from me. > > FWIW, Wayland does not have repeat events itself. A toolkit may > manufacture those any way it wants based on keyboard state (the exact > state you seem to be wanting in the first place). > >> Initial code tests I've made directly against evdev prove that the >> input seen is accurate and properly reported. Grabbing all the input >> devices is easy. Releasing and reacquiring all of them based on >> window focus is easy. Identifying what each device is and which to >> use is easy. I have no idea what you are talking about with Re: to >> permissions and security. I'm not sure where in the original software >> stack the input code is being ruined, but to whomever code that >> belongs, if you cannot deliver accurate input from the kernel with >> 100% confidence, you cannot be trusted to decide permissions or >> security, either. > I'm not convinced, but I won't argue about the easyness. > > The security/permissions problem is this: if you are allowed to open > the input devices, you can also trivially implement an invisible > keylogger, just "forget" to close the devices. Obviously people don't > like that idea, hence in a usual system the input device permissions > are restricted, probably as far as to the root user. Hence your game > needs to run as root, or ask the user to bypass the set permissions > e.g. by adding himself to the 'input' group (which now opens the door > for keyloggers). Display servers often use logind DBus API to open input > devices to avoid running as root, but I believe logind would refuse > your game if a display server was also active at the same time. > > > Thanks, > pq > > >> On 02/20/2017 09:20 PM, Pekka Paalanen wrote: >>> On Mon, 20 Feb 2017 12:37:36 +1300 >>> Bryan Baldwin <[email protected]> wrote: >>> >>>> Okay, so further investigation has lead me to test code against >>>> evdev directly. Nevermind ;) >>> But if you run under any kind of display server (windowing system), >>> that won't usually work at all, or works wrong. >>> >>> That is also why any kind of "bypass the display server" will not >>> generally work. There is a myriad of reasons for that, including >>> permission and security issues, even starting from how to even pick >>> the right devices. >>> >>> You really are expected to keep the keyboard state tracked in your >>> app, based on the events. Even evdev works like that. If you were >>> writing for Wayland, there would be libxkbcommon to do that, and I >>> believe SDL2 already uses libxkbcommon anyway (on Wayland). >>> >>> OTOH, if you were not running under any display server, then you'd >>> be fine with that approach. >>> >>> Your question would be better directed at SDL or the specific window >>> system fora (e.g. mailing lists). >>> >>> >>> Thanks, >>> pq >> -- _______________________________________________ xdg mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xdg
0xD64E442F.asc
(application/pgp-keys, 3 KB)
-----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFe/ohABEADQ0E7ABrbvWQFpongG13PKx1Bf0xKeAf2FFJJHxa93l6HFP0DJ t6bn/5shFu/9pryYUvpbyyc67Zkwtk9Lfj2Z+/xKhiQ9zhqXwgqozt6imUEfwYbt wrm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FKbvdlhZxTmGDpMyiCQ5Hgl LHxTM/wH9Oq3p0i3LN+2teoFqpxIhzneT02Jm95UlLB5JA4lzH8WtmwqmZemu6Yq xGE3uDly6fbR7Vz5E5Wk1LmGnT+A2q1PIycvElGx+8OSYgOmaHV2a3jVJH9pn64Z +JOt71K+RoMVYW0ARDntU8AA0Au+u2OrKHY+LshotjGXEupNTMb55gLd84JjSL3d e1mlBEzDnvLM4v8ftF0cfUo0rboj5IgfF3pFGpmodcUyOb7Eu82koKFLZuov6wrF CHKj06dQ//O1SUiLO1mupXrGQV/k0/ACFIO+GFTv1FM7nID+aehrCAqDM9NLODbk LouncNAC6kGVhloe6w7W0otdqx/CF1HUgvUOTqWI4JSYxj5wtzLGSm7xS80W4ASc vx+56AOEtxVLeluKLHsjOkWg9PdZdDT09JPoOIECoBjZQSvg1tekmYAA93e1IKcA pwSnacSDkEjKgv3BMbI48r1j03ONcaeym672kfUAqhllSsGl6SB+WOZcHbT8QMrN 93LKcRJObUksTIvEsCmv1qdX3mLNX/uifrHCvuTR8mdOYFMnnibTZJ5wkrcGisf4 iPJFZY2rNxRyv+qlxEPLUXqeYN3Q8QgYusuOVh7a4pXRSs/htxZ8JXSELU8Rhpc6 SaA= =Er4M -----END PGP PUBLIC KEY BLOCK-----
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE1OFiBHnOnhbgzKuUFdP+xtZORC8FAlireX8ACgkQFdP+xtZO RC/NQBAAg9o8c1reMcN/3+JfBoilxydoUmURmwjCHN41+e07RLgmvHBJeC8Gy8P9 Y3FqemMEjzqeC6rRyrNQwI54oG/zkjbEf/quklWOZzVxjGr3x6JBOtkJr46kDC4y PsQ5HxVjFImI4DYROrZAJ4EOBXhIxvKt3AXPGA540Yp2XSctJcOe+lzW6/bpO1e3 9UXTwCvoZSYSgnCrG+xpzrZJefVgc9hSazRTr0Zkm6kcGHmsiIrW7nyGtO7K2BCj FrV5dD3k+sGYFu2ZCKQaY6JkCHQ9AQF06aYuHkrLVcWK36MhqFy4Ii50pGXenyK6 oWjXLlfQDWh9yuUYKLsHblPlhuXPc3Zg9qEM0/d5vmS6uzdfJ0fHG397gvTflQiR oDBbKMPHgBFgnEX74ehoNhJG0tnqUczcyXR7Ru3S9wxh9A3TLg1BiR/6W07MDDtm 6NaaHHf3vYR3kyF3kVCbKxLAm+jahTFKoTsnBjHQ4PgGKX7TAglYDLkRvAwfyDyr uMQyeNYuRFg7q26TB2I9Jyn4Hn/EatxcmCI6zrExHZjMmYzqaETG3WfKIRTjBs8i vBav1y5LhapDZjq2Y/bUe3NAqKvAjXF/o9xJ/OEYaBz/zwDPARwCZuqPaibMkPh1 Zs+UTn6Sgu+pgzJ2l4auoRQIwpp+4dvvHkXRcSHUCKhfyy3tauU= =Pf+5 -----END PGP SIGNATURE-----