Bug 474588 - gdmgreeter crashes if input device (ex wacom) is defined but not plugged
Summary: gdmgreeter crashes if input device (ex wacom) is defined but not plugged
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gdm
Version: 5.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ray Strode [halfline]
QA Contact: desktop-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-04 15:55 UTC by Olivier Fourdan
Modified: 2018-10-20 02:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 11:28:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch for current gdm-2.16 package in EL5 (2.09 KB, patch)
2008-12-04 15:55 UTC, Olivier Fourdan
no flags Details | Diff
Same patch if the one from bz#473262 is applied (1.20 KB, patch)
2008-12-04 15:59 UTC, Olivier Fourdan
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:1364 0 normal SHIPPED_LIVE Low: gdm security and bug fix update 2009-09-01 10:59:13 UTC

Description Olivier Fourdan 2008-12-04 15:55:34 UTC
Created attachment 325697 [details]
Patch for current gdm-2.16 package in EL5

Description of problem:

The gdmgreeter will fail to start if a xinput device is defined in the xorg.conf but is not actually plugged in.

This happens for example when a Wacom tablet was added in xorg.conf but the device is not plugged in when gdm starts.


Version-Release number of selected component (if applicable):

    gdm-2.16.0-46

How reproducible:

    100% reproducible

Steps to Reproduce:
1. Add devices to teh xorg.conf

        InputDevice    "stylus" "SendCoreEvents"
        InputDevice    "eraser" "SendCoreEvents"
        InputDevice    "cursor" "SendCoreEvents"

        Section "InputDevice"
                Identifier  "stylus"
                Driver      "wacom"
        ...
        EndSection
        
        Section "InputDevice"
                Identifier  "eraser"
                Driver      "wacom"
        ...
        EndSection
        
        Section "InputDevice"
                Identifier  "cursor"
                Driver      "wacom"
        ...
        EndSection

2. Do _not_ plug any additional device
3. Restart gdm
  
Actual results:

    “The greeter application appears to be crashing.
     Attempting to use a different one.”

Expected results:

The greeter is displayed correctly.

Additional info:

The problem comes from the additional modules dwellmouselistener and keymouselistener which try to open the extended devices reported by XInput without checking for errors.

In gui/modules/keymouselistener.c and gui/modules/dwellmouselistener.c, the same code is duplicated and does:


   static void
   init_xinput (GdkDisplay *display, GdkWindow *root)
   {
   ...
       devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display),
           &num_devices);

   ...

       for (i=0; i < num_devices; i++) {
           if (devices[i].use == IsXExtensionDevice) {
               device = XOpenDevice (GDK_DISPLAY_XDISPLAY (display),
                   devices[i].id);
               for (j=0; j < device->num_classes && number < 39; j++) {
                   switch (device->classes[j].input_class)
                   {

   ...

That code works in most cases, except when the device is defined but not actually there, in which case the call to XOpenDevice() will cause an X error. Since there is no mechanism in place to trap that error, the gdmgreeter will fail and cause the error reported.

The proper way (IMHO) to handle this is to protect the call to XOpenDevice() by wrapping it in an X error handler, ie change the code to:

   static void
   init_xinput (GdkDisplay *display, GdkWindow *root)
   {
   ...
       devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display),
           &num_devices);

   ...

       for (i=0; i < num_devices; i++) {
           if (devices[i].use == IsXExtensionDevice) {
               gdk_error_trap_push ();
               device = XOpenDevice (GDK_DISPLAY_XDISPLAY (display),
                   devices[i].id);
               if (gdk_error_trap_pop())
               {
                   if (debug_gestures)
                       syslog (LOG_WARNING, "Failed to open input devices %i (%s)",
                           devices[i].id, devices[i].name);
                   continue;
               }
               for (j=0; j < device->num_classes && number < 39; j++) {
                   switch (device->classes[j].input_class)
                   {
   ...


The bug is still upstream (at least in gdm that comes with gnome-2.20, the last one before gdm was changed).

Comment 1 Olivier Fourdan 2008-12-04 15:59:20 UTC
Created attachment 325700 [details]
Same patch if the one from bz#473262 is applied

Now, this patch modifies a part of the code that is modified by another patch for BZ#473262 (“Mouse cursor not movable when using tablet instead of mouse”)

The patch for BZ#473262 removes the XInput code from “dwellmouselistener.c” so if that other patch for BZ#473262 is applied, then better use this one patch that fixes only the portion remaining in “keymouselistener.c”

Comment 3 Ray Strode [halfline] 2009-01-05 17:48:08 UTC
devack+

Comment 4 Ray Strode [halfline] 2009-05-12 14:40:40 UTC
building as gdm-2.16.0-49.el5 now.  Marking MODIFIED for QA.

Comment 6 Chris Ward 2009-07-03 18:15:07 UTC
~~ Attention - RHEL 5.4 Beta Released! ~~

RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.

Questions can be posted to this bug or your customer or partner representative.

Comment 9 errata-xmlrpc 2009-09-02 11:28:42 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1364.html


Note You need to log in before you can comment on or make changes to this bug.