Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 560330 - gnome-base/gnome-shell-3.16.3 segfaults on start when spidermonkey:24 is compiled with -fno-stack-protector
Summary: gnome-base/gnome-shell-3.16.3 segfaults on start when spidermonkey:24 is comp...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://bugzilla.gnome.org/show_bug.c...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-13 09:57 UTC by Pacho Ramos
Modified: 2018-07-30 22:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
backtrace (01gnome-shell.backtrace,28.91 KB, text/plain)
2015-09-13 09:57 UTC, Pacho Ramos
Details
backtrace-r1 (gnome-shell-3.16backtrace.txt,29.82 KB, text/plain)
2015-09-13 20:35 UTC, Pacho Ramos
Details
backtrace-r2 (gnome-shell-3.16backtrace-mutter.txt,39.57 KB, text/plain)
2015-09-14 06:31 UTC, Pacho Ramos
Details
workaround patch for x11-wm/mutter-3.16.3 (0001-keybindings-meta_backend_get_keymap-can-return-NULL.patch,1.45 KB, patch)
2015-09-14 12:44 UTC, Alexandre Rostovtsev (RETIRED)
Details | Diff
backtrace with the patch applied (gnome-shell-3.16.3-backtrace-mutter-patch1.txt,28.08 KB, text/plain)
2015-09-14 15:02 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2015-09-13 09:57:49 UTC
Created attachment 411784 [details]
backtrace

Hello

My father is having some problems with gnome-shell on some computers. It crashes on start and, then, people cannot login at all and even GDM cannot work.

I attach the backtrace. Please let me know if it's enough

Thanks a lot for your help
Comment 1 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-13 15:57:38 UTC
(In reply to Pacho Ramos from comment #0)

#0  xkb_keymap_ref (keymap=keymap@entry=0x0) at /usr/src/debug/x11-libs/libxkbcommon-0.5.0/libxkbcommon-0.5.0/src/keymap.c:59
No locals.
#1  0x00007ff0baa59b7f in xkb_state_new (keymap=0x0) at /usr/src/debug/x11-libs/libxkbcommon-0.5.0/libxkbcommon-0.5.0/src/state.c:582
        ret = 0x1e91390
#2  0x00007ff0bbe629a3 in ?? () from /usr/lib64/libmutter.so.0
No symbol table info available.
#3  0x00007ff0bbe649e0 in ?? () from /usr/lib64/libmutter.so.0
No symbol table info available.


The crash happens because xkb_state_new is being called with NULL keymap argument.

Please rebuild mutter with debugging symbols to see where that NULL is coming from.
Comment 2 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-13 16:14:53 UTC
AFAICT, this could happen because xkb_x11_keymap_new_from_device() returns NULL, since mutter will happily use that value.

Please check your logs for anything keyboard-related. Please check your X config to make sure you aren't doing somethings strange with keyboard devices or with key mappings.
Comment 3 Pacho Ramos gentoo-dev 2015-09-13 20:35:58 UTC
Created attachment 411822 [details]
backtrace-r1

This backtrace is with spidermonkey and nspr recompile with debugging symbols

It's important to note that compiling spidermonkey WITHOUT -pipe in CFLAGS solves the problem, while recompiling it again with "-pipe" makes it break again :/
Comment 4 Pacho Ramos gentoo-dev 2015-09-13 20:38:11 UTC
[ebuild   R    ] sys-devel/gcc-4.8.5:4.8::gentoo  USE="cxx fortran gcj (multilib) nptl openmp sanitize (-altivec) (-awt) -debug -doc (-fixed-point) -go -graphite (-hardened) (-libssp) -mudflap (-multislot) -nls -nopie -nossp -objc -objc++ -objc-gc -regression-test -vanilla" 0 KiB

This is the gcc version
Comment 5 Pacho Ramos gentoo-dev 2015-09-14 06:31:28 UTC
Created attachment 411874 [details]
backtrace-r2

This is with mutter compiled with debugging symbols
Comment 6 Pacho Ramos gentoo-dev 2015-09-14 09:07:45 UTC
I have just reproduced this in one more computer... in that one it was solved recompiling spidermonkey without -fno-stack-protector :/

Portage 2.2.20.1 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.8.5, glibc-2.20-r2, 4.0.5-gentoo x86_64)
=================================================================
System uname: Linux-4.0.5-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E7500_@_2.93GHz-with-gentoo-2.2
KiB Mem:     3916424 total,   1629292 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Mon, 14 Sep 2015 08:00:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.24 p1.4) 2.24
ccache version 3.1.9 [enabled]
app-shells/bash:          4.3_p39::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.4.1::gentoo
dev-util/ccache:          3.1.9-r4::gentoo
dev-util/cmake:           3.2.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            4.8.5::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

science
    location: /usr/portage/local/layman/science
    masters: gentoo
    priority: 0

vmware
    location: /usr/portage/local/layman/vmware
    masters: gentoo
    priority: 1

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 2

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -fno-stack-protector"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -fno-stack-protector"
DISTDIR="/usr/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n --autounmask-write --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.heanet.ie/pub/gentoo/"
LANG="es_ES.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 applet avahi bash-completion berkdb branding bzip2 cairo ccache cdda cddb cdr cli colord cracklib crypt cups cvs cxx dbus djvu dri dts dvd dvdr dvi eds emboss enchant encode evo exif fam fat ffmpeg firefox flac fortran fuse gdbm gif glamor gnome gnome-keyring gnome-online-accounts gphoto2 gpm gstreamer gtk gtk3 gtkstyle gui hfs http iconv infinality introspection irc jabber jpeg kpathsea latex lcms ldap libnotify libsecret libvisual lyx mad mms mmx mmxext mng modules monolithic-build mp3 mp4 mpeg multilib musicbrainz nautilus ncurses network-cron networkmanager nls nptl ntfs numa ogg opengl openmp optimized-qmake pam pango pch pdf png policykit ppds pulseaudio qt3support qt4 readline reiserfs scanner sdl seccomp session smp spell sse sse2 ssl startup-notification svg systemd t1lib tcpd theora threads tiff tracker truetype udev udisks unicode upnp upnp-av upower usb v4l vaapi vala vcd vdpau vorbis wifi wxwidgets x264 xattr xcb xfs xml xv xvid youtube zeroconf zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="es es_ES en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="fbdev vesa radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 7 Pacho Ramos gentoo-dev 2015-09-14 09:13:58 UTC
About X configuration, this is the only file (generated with systemd helpers for configuring keymaps via localectl):
$ cat 00-keyboard.conf 
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "gb,es"
        Option "XkbVariant" ","
EndSection

The other machines only have "es" as Layout and no Variant

As a side note, I have found this spidermonkey bug about stack corruption:
https://bugzilla.mozilla.org/show_bug.cgi?id=1083464

Sorry if it's not related, but I don't know much about this stuff :'(
Comment 8 Pacho Ramos gentoo-dev 2015-09-14 09:22:51 UTC
About logs... this is the only one I find't just before crashing:
sep 14 10:53:25 optiplex760 gnome-session[31409]: xkbcommon: ERROR: xkb_x11_keymap_new_from_device: illegal device ID: -1
sep 14 10:53:25 optiplex760 kernel: gnome-shell[31446]: segfault at 8 ip 00007f9b8e6ee4e0 sp 00007ffe06f22aa8 error 6 in libxkbcommon.so.0.0.0[7f9b8e6d3000+3c
Comment 9 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-14 12:26:06 UTC
(In reply to Pacho Ramos from comment #8)
> sep 14 10:53:25 optiplex760 gnome-session[31409]: xkbcommon: ERROR:
> xkb_x11_keymap_new_from_device: illegal device ID: -1

This explains it. It means xkb_x11_keymap_new_from_device() will return NULL, and mutter will assign it to priv->keymap and later blindly attempt to use it (leading to the segfault).

See src/backends/x11/meta-backend-x11.c in mutter source.

As a workaround to prevent segfaults, we can patch mutter to add some checks that priv->keymap is not NULL before using it.

Next question: why did xkb_x11_get_core_keyboard_device_id() return -1?
Comment 10 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-14 12:44:04 UTC
Created attachment 411892 [details, diff]
workaround patch for x11-wm/mutter-3.16.3

See if this helps.
Comment 11 Pacho Ramos gentoo-dev 2015-09-14 13:09:21 UTC
(In reply to Alexandre Rostovtsev from comment #10)
> Created attachment 411892 [details, diff] [details, diff]
> workaround patch for x11-wm/mutter-3.16.3
> 
> See if this helps.

It still crashes. For that I have simply re-emerged spidermonkey:24 with -fno-stack-protector flag, that change makes it crash again. I have applied the patch to mutter and, even if it allows me to get gdm started after multiple tries and even login in gnome, it crashes again really often. I mean, without the patch it crashes near always, with this one it takes a few more seconds to crash :(

Also, I don't understand what changes using -fno-stack-protector or not with spidermonkey to make this crash to appear :|

(In reply to Alexandre Rostovtsev from comment #9) 
> Next question: why did xkb_x11_get_core_keyboard_device_id() return -1?

I don't know how to reply to that :(
Comment 12 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-14 13:18:10 UTC
(In reply to Pacho Ramos from comment #11)
> It still crashes. For that I have simply re-emerged spidermonkey:24 with
> -fno-stack-protector flag, that change makes it crash again. I have applied
> the patch to mutter and, even if it allows me to get gdm started after
> multiple tries and even login in gnome, it crashes again really often. I
> mean, without the patch it crashes near always, with this one it takes a few
> more seconds to crash :(

Can you get a backtrace for the crash with the patch? It should be in a different place - maybe the core cause of the problem this time.
Comment 13 Pacho Ramos gentoo-dev 2015-09-14 13:32:29 UTC
(In reply to Pacho Ramos from comment #11)
[...]
> (In reply to Alexandre Rostovtsev from comment #9) 
> > Next question: why did xkb_x11_get_core_keyboard_device_id() return -1?
> 
> I don't know how to reply to that :(

Well, maybe this error doesn't occur at first, looking again to all logs (sorry, journald becomes huge and makes it scroll really slow :S), sometimes it's logged before, others after the crash. Probably it returns -1 because X crash and, then, the error should be "normal"

(In reply to Alexandre Rostovtsev from comment #12) 
> Can you get a backtrace for the crash with the patch? It should be in a
> different place - maybe the core cause of the problem this time.

I will try, it will require a bit of time as this machine doesn't have anything compiled with debugging symbols yet :)
Comment 14 Pacho Ramos gentoo-dev 2015-09-14 15:02:54 UTC
Created attachment 411910 [details]
backtrace with the patch applied

This is after applying the patch... but it looks really short :/
Comment 15 Pacho Ramos gentoo-dev 2015-09-14 15:03:37 UTC
Instead of a segfault I get a trap :|
Comment 16 Pacho Ramos gentoo-dev 2015-09-15 10:14:38 UTC
Compiling spidermonkey using -O0 lets me to also use -fno-stack-protector without issues... but using -O1 + -fno-stack-protector makes it crash again

The problem is that I have tried to compile it appending -O0 and the options supposedly added by -O1 from "man gcc" and it still works !?

# CFLAGS="-O1 -pipe -fno-stack-protector" CXXFLAGS="${CFLAGS}" emerge -1 spidermonkey:24 -> crashes

# CFLAGS="-O0 -pipe -fno-stack-protector" CXXFLAGS="${CFLAGS}" emerge -1 spidermonkey:24 -> works


# CFLAGS="-O0 -fauto-inc-dec -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch -fdse -fguess-branch-probability -fif-conversion2 -fif-conversion -fipa-pure-const -fipa-profile -fipa-reference -fmerge-constants -fsplit-wide-types -ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-slsr -ftree-sra -ftree-pta -ftree-ter -funit-at-a-time -fomit-frame-pointer -pipe -fno-stack-protector" CXXFLAGS="${CFLAGS}" emerge -1 spidermonkey:24 -> works... even if it should be equivalent to -O1
Comment 17 Ian Stakenvicius (RETIRED) gentoo-dev 2015-09-15 13:50:46 UTC
(In reply to Pacho Ramos from comment #16)
> Compiling spidermonkey using -O0 lets me to also use -fno-stack-protector
> without issues... but using -O1 + -fno-stack-protector makes it crash again
> 

There's another package in between here though, right?  dev-libs/gjs?? Checking out configure.ac for GJS, there's an --enable-coverage that forces  CFLAGS="$CFLAGS -g -O0 --coverage"; I don't know how GJS gets configured by default in gentoo but if coverage is default-enabled might it require spidermonkey to be built similarly (with -O0) the way you are reporting??
Comment 18 Pacho Ramos gentoo-dev 2015-09-15 17:47:48 UTC
Indeed, gjs is the "link" with spidermonkey, but we explicitly pass --disable-coverage to it and, indeed, it's being build with normal CFLAGS as taken from make.conf, it's not forcing -O0 on Gentoo :/
Comment 19 白川間瀬流 2017-01-10 14:21:36 UTC
As 3.16 GNOME-Shell is no longer in portage, is this bug still relevant?
Comment 20 Mart Raudsepp gentoo-dev 2018-07-30 22:37:21 UTC
Closing due to lack of updates, reopen if still relevant.