Bug#261783: gdmgreeter doesn't handle unreadable fonts gracefully

Matthew Sanderson Matthew Sanderson <matthew@formtrap.com>, 261783@bugs.debian.org
Wed, 28 Jul 2004 16:50:07 +1000


Package: gdm
Version: 2.6.0.3-1
Severity: grave
Justification: renders package unusable

Summary: GDMGreeter does not gracefully handle the condition whereby it is trying to open a font file, but 
the font file is not readable.

I have put a number of symlinks in /usr/share/fonts/truetype/commercial/, pointing to TrueType font files 
stored in a different filesystem, namely in '/dosc/winnt/Fonts'. This may or may not be a good idea; for 
the purposes of this bugreport it does not matter.

When the /dosc vfat filesystem containing the fonts is mounted with options that enable all users to read 
the font files contained therein (eg umask=0000), gdmgreeter can also read the fonts and everything works 
as expected.

When the filesystem is mounted with options that deny whichever user 'gdmgreeter' runs as access to the 
font files, gdmgreeter does the following (from 'strace -f gdm --nodaemon >log 2>&1):

[pid  4003] open("/usr/share/fonts/truetype/commercial/verdana.ttf", O_RDONLY) = -1 EACCES (Permission 
denied)
[pid  4003] getpid()                    = 4003
[pid  4003] open("/usr/lib/charset.alias", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
[pid  4003] write(2, "\n** (gdmgreeter:4003): WARNING *"..., 77) = 77
[pid  4003] open("/usr/share/fonts/truetype/commercial/verdana.ttf", O_RDONLY) = -1 EACCES (Permission 
denied)
[pid  4003] getpid()                    = 4003
[pid  4003] write(2, "\n** (gdmgreeter:4003): WARNING *"..., 76) = 76
[pid  4003] exit_group(1)               = ?

As you can see, gdmgreeter is treating failure to access one of a great many font files as a fatal error 
and is exiting immediately with an error code.
This in turn causes gdm to exit with an error code, which causes the X session to end, which leads to an 
infinite loop of restarting X sessions and an unusable system. Thus, a small problem regarding one of many 
font files becomes a larger problem (no X) which in turn becomes a very serious problem (entire system 
unusable).

I suggest that gdmgreeter should degrade gracefully when font file(s) are absent, unreadable, or otherwise 
unusable, instead of exiting. One way of gracefully handling such conditions would be to fall back to 
another font.

Also, why does gdmgreeter try to open(2) the same font file twice? If open(2) failed first time with 
errno==EACCES, then it will also fail second time - there are no intervening chmod calls. I could 
understand this behaviour if errno==EGAIN or something similar, but it doesn't, so this seems like a 
pointless waste of CPU cycles. But I don't find this important enough to justify a seperate bug report.

Also, why does 'gdmgreeter' print 'WARNING', when it is about to exit with status 1? Isn't this behaviour 
the very definition of a fatal error, as opposed to merely a warning?

Another problem is that the error messages printed by gdmgreeter (writes to fd 2 in strace output above) go 
nowhere - at this point, fd 2 is opened to /dev/null. This makes it very hard to diagnose problems in 
gdmgreeter. The information in syslog from gdm is not sufficient to diagnose faults in sub-processes such 
as gdmgreeter. I think this deserves a seperate bug report.

Cheers,

--m@

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=C, LC_CTYPE=C

Versions of packages gdm depends on:
hi  adduser                     3.49         Add and remove users and groups
ii  debconf                     1.4.29       Debian configuration management sy
ii  dpkg                        1.10.15      Package maintenance system for Deb
ii  gksu                        1.2.0-2      graphical frontend to su
ii  gnome-session               2.4.2-2      The GNOME 2 Session Manager
ii  gnome-terminal [x-terminal- 2.2.2-4      The GNOME 2 terminal emulator appl
ii  libart-2.0-2                2.3.16-5     Library of functions for 2D graphi
ii  libatk1.0-0                 1.6.1-2      The ATK accessibility toolkit
ii  libattr1                    2.4.15-1     Extended attribute shared library
ii  libbonobo2-0                2.6.2-4      Bonobo CORBA interfaces library
ii  libbonoboui2-0              2.6.1-1      The Bonobo UI library
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an
ii  libgconf2-4                 2.6.2-1      GNOME configuration database syste
ii  libglade2-0                 1:2.4.0-1    Library to load .glade files at ru
ii  libglib2.0-0                2.4.2-1      The GLib library of C routines
ii  libgnome2-0                 2.6.1-6      The GNOME 2 library - runtime file
ii  libgnomecanvas2-0           2.6.1.1-2    A powerful object-oriented display
ii  libgnomeui-0                2.6.1.1-3    The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0              2.6.1.1-3    The GNOME virtual file-system libr
ii  libgtk2.0-0                 2.4.3-1      The GTK+ graphical user interface 
ii  libice6                     4.3.0-7      Inter-Client Exchange library
ii  liborbit2                   1:2.10.2-1.1 libraries for ORBit2 - a CORBA ORB
hi  libpam-modules              0.76-7       Pluggable Authentication Modules f
ii  libpam-runtime              0.76-15      Runtime support for the PAM librar
hi  libpam0g                    0.76-7       Pluggable Authentication Modules l
ii  libpango1.0-0               1.4.0-4      Layout and rendering of internatio
hi  libpopt0                    1.7-2        lib for parsing cmdline parameters
ii  librsvg2-2                  2.7.2-3      SAX-based renderer library for SVG
ii  libselinux1                 1.14-2       SELinux shared libraries
ii  libsm6                      4.3.0-7      X Window System Session Management
ii  libwrap0                    7.6-ipv6.1-3 Wietse Venema's TCP wrappers libra
ii  libx11-6                    4.3.0-7      X Window System protocol client li
ii  libxext6                    4.3.0-7      X Window System miscellaneous exte
ii  libxml2                     2.6.10-3     GNOME XML library
ii  metacity [x-window-manager] 1:2.4.55-2   A lightweight GTK2 based Window Ma
ii  xbase-clients               4.3.0-7      miscellaneous X clients
ii  xlibs                       4.3.0-7      X Window System client libraries m
ii  xterm [x-terminal-emulator] 4.2.1-3      X terminal emulator
hi  zlib1g                      1:1.2.1-4    compression library - runtime

-- debconf information:
  gdm/daemon_name: /usr/bin/gdm
  shared/default-x-display-manager: gdm