Bug 99845

Summary: Enabling button scrolling on L/R with middle button emulation enabled triggers a bug
Product: Wayland Reporter: Peter Hutterer <peter.hutterer>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 94856    
Bug Blocks:    

Description Peter Hutterer 2017-02-17 01:06:49 UTC
Enabling button scrolling on the left or right button with middle button
emulation enabled triggers a timer bug assertion in libinput. Cause is that
once the middle button expires, it sends the button event with the original
event timestamp (but delayed by the timeout).

That feeds into the scroll button emulation code which triggers the next
timer for the scroll expiry, based on the event timestamp. That triggers the
assertion in the timer system because it checks the current time against the
event timestamp (which is now in the past).


Output from the test suite:
    litest debug: event18: tagged as LIBINPUT_MODEL_TRACKBALL
    litest debug: event18: tagged as LIBINPUT_MODEL_LOGITECH_MARBLE_MOUSE
    litest debug: event18: tagged as ID_INPUT_TRACKBALL
    litest info: input device 'litest Logitech USB Trackball', /dev/input/event18 is tagged by udev as: Mouse Trackball
    litest info: input device 'litest Logitech USB Trackball', /dev/input/event18 is a pointer caps
    litest debug: middlebuttonstate: MIDDLEBUTTON_IDLE → MIDDLEBUTTON_EVENT_L_DOWN → MIDDLEBUTTON_LEFT_DOWN, rc 1
    litest error: libinput bug: timer offset negative (-100109)
    FAILED: aborting
    libinput bug triggered, aborting.
    in litest_log_handler() (litest.c:803)

    Backtrace:
    0: litest_fail_condition() (.today/libinput/test/litest.c:284)
    1: litest_log_handler() (.today/libinput/test/litest.c:804)
    2: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (log_msg_va+0x52) [0x7fab423f5206]
    3: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (log_msg+0xba) [0x7fab423f52c3]
    4: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (libinput_timer_set+0x5c) [0x7fab4241d6c0]
    5: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (evdev_button_scroll_button+0x53) [0x7fab423fda3c]
    6: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (evdev_pointer_notify_button+0x4a) [0x7fab423fdb28]
    7: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (middlebutton_post_event+0x2c) [0x7fab42405246]
    8: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (evdev_middlebutton_ldown_handle_event+0x14d) [0x7fab42405423]
    9: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (evdev_middlebutton_handle_event+0x87) [0x7fab42405b8f]
    10: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (evdev_middlebutton_handle_timeout+0x38) [0x7fab42405f26]
    11: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (libinput_timer_handler+0x110) [0x7fab4241d8d7]
    12: /home/whot/tmp/today/libinput/src/.libs/libinput.so.10 (libinput_dispatch+0xbe) [0x7fab423f8e10]
    13: litest_button_scroll() (.today/libinput/test/litest.c:2094)
    14: pointer_scroll_button() (.today/libinput/test/test-pointer.c:999)
    15: /lib64/libcheck.so.0 (srunner_run+0x869) [0x7fab42839db9]
    16: litest_run_suite() (.today/libinput/test/litest.c:945)
    17: litest_run() (.today/libinput/test/litest.c:998)
    18: main() (.today/libinput/test/litest.c:3581)
    19: /lib64/libc.so.6 (__libc_start_main+0xf1) [0x7fab412ed401]
    20: ./test/libinput-test-suite-runner (_start+0x2a) [0x40980a]
    21: ? (?+0x2a) [0x2a]
Comment 1 Peter Hutterer 2017-02-17 09:05:10 UTC
Given d76263a00fc0b82906043c276d93b7081f6ab81e, we've basically committed to not using middle button emulation and scroll button on the same button anyway, so the fix for this race condition is to not allow both on the same button instead of relying on undefined behaviour.
Comment 3 Peter Hutterer 2017-02-21 22:17:31 UTC
commit e43f9da9ecea6d17100c0012a89f5d162b2d7d7b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Feb 20 09:14:42 2017 +1000

    evdev: allow button scrolling on the L/R button with middle emulation active
Comment 4 Pokemon 2019-04-11 05:45:03 UTC
Here are the update to all players online just visit here http://mahjongfreegames.online/dark-dimensions and play the amazing Play free mahjong dark dimensions online.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.