Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1365967 - gnome-shell segfaults if XDG_DATA_DIRS includes an inaccessible directory
Summary: gnome-shell segfaults if XDG_DATA_DIRS includes an inaccessible directory
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gjs
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Colin Walters
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-10 15:57 UTC by Jonathan Billings
Modified: 2018-08-01 23:34 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Jonathan Billings 2016-08-10 15:57:31 UTC
Description of problem:
We provide extra software via a network mountpoint, and we were told in BZ#1353249 to add extra Gnome menus by defining $XDG_DATA_DIRS to include the location of the additional menus.  Because of license restrictions, not everyone can run this software, so not everyone has permission to see into the network share.  I've discovered that if one of the directories in $XDG_DATA_DIRS exists but does not permit users to read, gnome-shell will segfault, and you'll get the "Oh no!  Something has gone wrong." display where you can only log out. 

Version-Release number of selected component (if applicable):
gnome-shell-3.14.4-37.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create an inaccesible directory:  
mkdir -m 0700 /usr/inaccessible
mkdir -m 0700 /usr/inaccessible/dir

2. Add the inaccessible directory to XDG_DATADIRS:
echo 'export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share:/usr/local/share}:/usr/inaccessible/dir' > /etc/X11/xinit/xinitrc.d/99-extraapps.sh

3.  Attempt to log in using gnome-shell or gnome-shell classic.

Actual results:
You will be presented with the Oh no! error message with the only option to log out.

Expected results:
Normal login, user won't be able to see any menus in /usr/inaccessible, but otherwise normal.

Additional info:
When gnome-shell's javascript interpreter is trying to import the 'gi' class, it delves into several directories.  

In the journal, I'm seeing:

Aug 10 11:08:34 caen-z240.engin.umich.edu gnome-session[13178]: (gnome-shell:13468): Gjs-WARNING **: JS ERROR: Error: No property 'gi' in importer (or its value was undefined)
Aug 10 11:08:34 caen-z240.engin.umich.edu gnome-session[13178]: @<main>:1
Aug 10 11:08:34 caen-z240.engin.umich.edu kernel: gnome-shell[13468]: segfault at 8 ip 00007f9baff143d0 sp 00007ffd698e51d8 error 4 in libmozjs-24.so[7f9bafd72000+562000]
Aug 10 11:08:34 caen-z240.engin.umich.edu gnome-session[13178]: WARNING: Application 'gnome-shell-classic.desktop' killed by signal 11
Aug 10 11:08:34 caen-z240.engin.umich.edu gnome-session[13178]: gnome-session[13178]: WARNING: Application 'gnome-shell-classic.desktop' killed by signal 11


When I attached 'strace' to gnome-shell when I logged in, I saw:


14612 open("/usr/share/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
14612 lstat("/usr/share/gjs-1.0/overrides", 0x7fffe16e8ac0) = -1 ENOENT (No such file or directory)
14612 open("/usr/local/share/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
14612 lstat("/usr/local/share/gjs-1.0/overrides", 0x7fffe16e8ac0) = -1 ENOENT (No such file or directory)
14612 open("/usr/inaccessible/dir/gjs-1.0/__init__.js", O_RDONLY) = -1 EACCES (Permission denied)
14612 write(2, "\n(gnome-shell:14612): Gjs-WARNING **: JS ERROR: Error: No property 'gi' in importer (or its value was undefined)\n@<main>:1\n\n", 124) = 124
14612 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x8} ---

if I change the permissions on /usr/inaccessible/dir so it's readable (0755), I see:

18720 open("/usr/share/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 lstat("/usr/share/gjs-1.0/overrides", 0x7ffedd4810a0) = -1 ENOENT (No such file or directory)
18720 open("/usr/local/share/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 lstat("/usr/local/share/gjs-1.0/overrides", 0x7ffedd4810a0) = -1 ENOENT (No such file or directory)
18720 open("/usr/inaccessible/dir/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 lstat("/usr/inaccessible/dir/gjs-1.0/overrides", 0x7ffedd4810a0) = -1 ENOENT (No such file or directory)
18720 open("/usr/share/gjs-1.0/__init__.js", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 lstat("/usr/share/gjs-1.0/overrides", 0x7ffedd4810a0) = -1 ENOENT (No such file or directory)
18720 stat("libglib-2.0.so.0", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 stat("libglib-2.0.so.0.so", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 stat("libglib-2.0.so.0.la", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 stat("libgobject-2.0.so.0", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 stat("libgobject-2.0.so.0.so", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 stat("libgobject-2.0.so.0.la", 0x7ffedd480570) = -1 ENOENT (No such file or directory)
18720 futex(0x7f1a2c1b54a8, FUTEX_WAKE, 2147483647) = 0
18720 futex(0x7f1a2c1b54a8, FUTEX_WAKE, 2147483647) = 0
18720 open("/usr/lib64/gjs/girepository-1.0/Clutter-1.0.typelib", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 open("/usr/lib64/gnome-shell/Clutter-1.0.typelib", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 open("/usr/lib64/mutter/Clutter-1.0.typelib", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 open("/usr/lib64/mutter/Clutter-1.0.typelib", O_RDONLY) = -1 ENOENT (No such file or directory)
18720 open("/usr/lib64/girepository-1.0/Clutter-1.0.typelib", O_RDONLY) = 22
18720 fstat(22, {st_mode=S_IFREG|0644, st_size=493400, ...}) = 0
18720 mmap(NULL, 493400, PROT_READ, MAP_PRIVATE, 22, 0) = 0x7f1a1405c000
18720 close(22)                         = 0

(and so on, it works)

The bug appears to be that gnome-shell's javascript engine (mozjs24) segfaults when it tries a directory and gets a EACCESS instead of ENOENT.

Comment 2 Florian Müllner 2016-09-07 17:40:02 UTC
This is an gjs issue - when trying to import a native module like gtk+ via its (gobject-introspection) typelib file, it needs to skip inaccessible directories and continue to the next candidate.


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