Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 380559 - >=gnome-base/gvfs-1.6.7: several gnome apps (nautilus, gedit, evince) crashes to do unaligned memory access
Summary: >=gnome-base/gvfs-1.6.7: several gnome apps (nautilus, gedit, evince) crashes...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: Sparc Linux
: Normal major (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://bugzilla.gnome.org/show_bug.c...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: unaligned-access
  Show dependency tree
 
Reported: 2011-08-24 20:07 UTC by chghs
Modified: 2023-05-08 17:21 UTC (History)
0 users

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


Attachments
gdb output when starting evince to open a document (gdb-evince.txt,1.38 KB, text/plain)
2011-08-24 20:17 UTC, chghs
Details
gdb output when starting gedit to open a document (gdb-gedit.txt,1.34 KB, text/plain)
2011-08-24 20:20 UTC, chghs
Details
output of 'G_DBUS_DEBUG=all evince ./pdf_test.pdf > output_evince.txt' (output_evince.txt,120.29 KB, text/plain)
2011-08-24 21:01 UTC, chghs
Details
Output of gvfs-mount -l (answer-to-comment-9.txt,4.09 KB, text/plain)
2011-08-26 19:08 UTC, chghs
Details
Xorg-Log (old) after calling 'nautilus .' which crahes (Xorg.0.log.old,76.09 KB, text/plain)
2011-08-26 19:30 UTC, chghs
Details
Xorg-Log after calling 'nautilus .' which crahes (no modifications in log file) (Xorg.0.log,69.43 KB, text/plain)
2011-08-26 19:32 UTC, chghs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chghs 2011-08-24 20:07:20 UTC
On a new installation of 2.6.39-gentoo-r3 with X and gnome several desktop applications (e.g. nautilus, gedit, evince, clock-applet/preferences) crash with 'bus error' when opening files/directories when environment variable DBUS_SESSION_BUS_ADDRESS is set. Gedit and evince can be launched without target file from the command line but they crash when opening some file from the menu. A workaround is to unset DBUS_SESSION_BUS_ADDRESS before launching the desktop application. In this case the applications work fine.

Reproducible: Always

Steps to Reproduce:
1.Open e.g. Places/Home Folder from the desktop panel
2.Right click on clock-applet -> Preferences
3.Open gedit or evince from panel or console and try to open some file
Actual Results:  
- Nautilus will restart and show nothing
- clock-applet crashes and asks to be reloaded
- gedit and evince crash

Expected Results:  
All applications should open the desired documents/files/directories

I have a new sparc-installation of 2.6.39-gentoo-r3. It is not an update of a previous version:

emerge --info
Portage 2.1.10.3 (default/linux/sparc/10.0/desktop/gnome, gcc-4.4.5, glibc-2.12.2-r0, 2.6.39-gentoo-r3 sparc64)
=================================================================
System uname: Linux-2.6.39-gentoo-r3-sparc64-sun4u-with-gentoo-2.0.3
Timestamp of tree: Mon, 15 Aug 2011 14:15:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.7.1-r1
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="sparc"
ACCEPT_LICENSE="* -@EULA"
CBUILD="sparc-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=ultrasparc -pipe"
CHOST="sparc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mcpu=ultrasparc -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="ftp://ftp.wh2.tu-dresden.de http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X a52 aac acl alsa berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fortran gcc64 gdbm gdu gif gnome gnome-keyring gpm gstreamer gtk iconv ipv6 jpeg lcms ldap libnotify mad mng modules mp3 mp4 mpeg mudflap nautilus ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support readline sdl session sparc spell ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb vorbis x264 xcb xml xorg xulrunner xv xvid zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint mach64 mga r128 radeon sunbw2 suncg14 suncg3 suncg6 sunffb sunleo tdfx dummy v4l" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 chghs 2011-08-24 20:17:44 UTC
Created attachment 284527 [details]
gdb output when starting evince to open a document

This output was generated with

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-oo8oQvSOpI,guid=c2d97c06cda8f31521caf89e00000144
Comment 2 chghs 2011-08-24 20:20:27 UTC
Created attachment 284529 [details]
gdb output when starting gedit to open a document

This output was generated with

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-oo8oQvSOpI,guid=c2d97c06cda8f31521caf89e00000144

If this variable is cleared, no error occurs.
Comment 3 chghs 2011-08-24 20:25:48 UTC
Further output of dbus-monitor can be provided if of interest. See also discussion at http://forums.gentoo.org/viewtopic-t-890582.html?sid=33394ff5b4473a9e29691352e5497cc3
Comment 4 Alexandre Rostovtsev (RETIRED) gentoo-dev 2011-08-24 20:43:26 UTC
Please attach the complete output of the following command:
G_DBUS_DEBUG=all evince
Comment 5 Alexandre Rostovtsev (RETIRED) gentoo-dev 2011-08-24 20:45:49 UTC
(In reply to comment #4)
> Please attach the complete output of the following command:
> G_DBUS_DEBUG=all evince

or better yet, tell it to open some existing pdf document (change the path accordingly):
G_DBUS_DEBUG=all evince ~/some_random_document.pdf
Comment 6 chghs 2011-08-24 21:01:04 UTC
Created attachment 284533 [details]
output of 'G_DBUS_DEBUG=all evince ./pdf_test.pdf > output_evince.txt'

lariano@elnath ~ $ env | grep DBUS
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-oo8oQvSOpI,guid=c2d97c06cda8f31521caf89e00000144
lariano@elnath ~ $ ls -l pdf_test.pdf 
-rw-r--r-- 1 lariano lariano 95502 Aug 17 11:23 pdf_test.pdf
lariano@elnath ~ $ G_DBUS_DEBUG=all evince ./pdf_test.pdf > output_evince.txt
Comment 7 Alexandre Rostovtsev (RETIRED) gentoo-dev 2011-08-24 21:12:24 UTC
Were there any error messages in the terminal before the crash?

(You redirected stdout to output_evince.txt, but stderr would still have been printed in the terminal.)
Comment 8 chghs 2011-08-25 18:25:15 UTC
The call of evince and gedit produces no error messages in the terminal nor in .xsession-errors nor in the system log file which for me is under /var/log/everything/current. Since these tools are compiled with debug options, at the end of the crash the Bug Reporting Tool opens :-)

Calling 'nautilus .' in my home directory produces the following error in the system log file:

Aug 25 20:08:54 [dbus] [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.21" (uid=1000 pid=2157 comm="nautilus ") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1290 comm="/usr/sbin/console-kit-daemon --no-daemon ")

and an entry in .xsession-errors:

nautilus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Initializing nautilus-gdu extension
** Message: Initializing gksu extension...

That's all I have found.
Comment 9 Alexandre Rostovtsev (RETIRED) gentoo-dev 2011-08-25 18:53:47 UTC
Very interesting...

It appears that there isn't anything wrong with the dbus or gdbus part of the equation. Next guess: maybe the bug is in gvfs.

What version of gvfs do you have emerged, and with what USE flags?

Please give the output of gvfs-mount -l
Comment 10 Alexandre Rostovtsev (RETIRED) gentoo-dev 2011-08-25 18:57:55 UTC
Also, please try
GIO_USE_VFS="local" evince ./pdf_test.pdf

Does that still crash? If it does, and the backtrace is different, please attach it.
Comment 11 Pacho Ramos gentoo-dev 2011-08-26 15:49:17 UTC
(In reply to comment #8)
[...]
> and an entry in .xsession-errors:
> 
> nautilus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
> Initializing nautilus-gdu extension
> ** Message: Initializing gksu extension...
> 
> That's all I have found.

Please attach /var/log/Xorg.0.log and /var/log/Xorg.0.log.old just after getting that message
Comment 12 chghs 2011-08-26 19:08:32 UTC
Created attachment 284735 [details]
Output of gvfs-mount -l

I noticed that the boot device is not listed in the output of 'gvfs-mount -l'. On ly cdrom and a secondary hard disk is found.
Comment 13 chghs 2011-08-26 19:16:05 UTC
# Setting GIO_USE_VFS="local" for the call of evince works!!! No crash!!!

lariano@elnath ~ $ env | grep DBUS
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-qhJMTfxFAF,guid=dc8aa7571df5a7898074fbab00000031
lariano@elnath ~ $ ls -l ./pdf_test.pdf 
-rw-r--r-- 1 lariano lariano 95502 Aug 17 11:23 ./pdf_test.pdf
lariano@elnath ~ $ file ./pdf_test.pdf 
./pdf_test.pdf: PDF document, version 1.5
lariano@elnath ~ $ GIO_USE_VFS="local" evince ./pdf_test.pdf
lariano@elnath ~ $ # NO CRASH :))
lariano@elnath ~ $
Comment 14 chghs 2011-08-26 19:18:13 UTC
# The command works also for gedit
GIO_USE_VFS="local" gedit gedit_test.txt

# NO CRASH !!!
Comment 15 chghs 2011-08-26 19:30:08 UTC
Created attachment 284741 [details]
Xorg-Log (old) after calling 'nautilus .' which crahes

lariano@elnath ~ $ date
Fri Aug 26 21:23:41 CEST 2011
lariano@elnath ~ $ tail -f .xsession-errors 
...
nautilus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Initializing nautilus-gdu extension
** Message: Initializing gksu extension...
nautilus: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Initializing nautilus-gdu extension
** Message: Initializing gksu extension...


elnath log # ls -l Xorg*
-rw-r--r-- 1 root root 71096 Aug 26 20:52 Xorg.0.log
-rw-r--r-- 1 root root 77917 Aug 26 20:47 Xorg.0.log.old
elnath log # 

# No modification in Xorg.0.log on crash of nautilus
Comment 16 chghs 2011-08-26 19:32:45 UTC
Created attachment 284743 [details]
Xorg-Log after calling 'nautilus .' which crahes (no modifications in log file)

The Xorg.0 log file. The file was not modified by crash.
Comment 17 Pacho Ramos gentoo-dev 2011-08-28 08:41:28 UTC
(In reply to comment #9)
> Very interesting...
> 
> It appears that there isn't anything wrong with the dbus or gdbus part of the
> equation. Next guess: maybe the bug is in gvfs.
> 
> What version of gvfs do you have emerged, and with what USE flags?
> 
> Please give the output of gvfs-mount -l

Then, Tetromino was right and this looks to be a gvfs problem, can you provide your gvfs version and USE flags for it?
Comment 18 Pacho Ramos gentoo-dev 2011-08-28 08:42:56 UTC
Forgot it, both are present in attached file :S
Comment 19 chghs 2011-09-07 07:12:28 UTC
After much investigation I have found the following conclusion:
My sparc system is not able to read a guint64 value if the addressed memory section is not 64-bit-aligned. This is the case when line 1306 of gvfs-1.6.7/metadata/metatree.c the value for guint64 mtime should be read:

mtime = GUINT64_FROM_BE (entry->mtime);

The memory section for reading mtime is created in line 1172:

data = mmap (NULL, statbuf.st_size, mmap_prot, MAP_SHARED, fd, 0);

This section starts with a 20-byte header (MetaJournalHeader) followed by 2x4 byte section for 

guint32 entry_size;
guint32 crc32;

Hence the value of guint64 mtime starts for the first entry of the journal at the offset 20 + 4 + 4 = 28 which is clearly not 8-byte-aligned. Testing a read operation at offset 0 in contrast (which is on my system always 8-byte-aligned) is successful. I have found a short patch which consists in reading two times a guint32 value and combining the results for a guint64 value:

lariano@elnath ~/work/anjuta/gvfs-1.6.7/metadata $ diff metatree.c.orig metatree.c
1306c1306,1312
<       mtime = GUINT64_FROM_BE (entry->mtime);
---
>       guint32* big_part = (guint32*)((char*) entry + 8);
>       guint64 big_part_64 = *big_part;
>       big_part_64 <<= 32;
>       guint32* little_part = (guint32*)((char*) entry + 12);
>       guint64 big_little = (big_part_64 | ((guint64)(*little_part)));		
>       mtime = GUINT64_FROM_BE (big_little);
> 

With this patch the problem for nautilus, gedit, evince and other desktop applications has gone. Only the clock-applet seems to have another problem :)
Comment 20 Pacho Ramos gentoo-dev 2011-09-11 09:16:11 UTC
Thanks a lot for your investigation. 

Looking at updated .c file from gvfs trunk, looks like this problem could still be unfixed by upstream:
http://git.gnome.org/browse/gvfs/tree/metadata/metatree.c

Could you please report this problem and you patch to upstream to let them know the problem and commit if ok?

-> bugzilla.gnome.org

Thanks a lot
Comment 22 Gilles Dartiguelongue (RETIRED) gentoo-dev 2012-10-25 22:01:47 UTC
Since upstream has been unresponsive to say the least, we really should add that patch to the ebuild if it fixes the problem. What say you team ?
Comment 23 Alexandre Rostovtsev (RETIRED) gentoo-dev 2012-10-26 01:14:14 UTC
(In reply to comment #22)
> Since upstream has been unresponsive to say the least, we really should add
> that patch to the ebuild if it fixes the problem. What say you team ?

I would much prefer a patch that ensures gvfs's structs are always written to aligned addresses in a buffer.
Comment 24 Pacho Ramos gentoo-dev 2013-08-24 13:12:56 UTC
(In reply to Alexandre Rostovtsev from comment #23)
> (In reply to comment #22)
> > Since upstream has been unresponsive to say the least, we really should add
> > that patch to the ebuild if it fixes the problem. What say you team ?
> 
> I would much prefer a patch that ensures gvfs's structs are always written
> to aligned addresses in a buffer.

Do we keep waiting or use current patch? (I don't have enough knowledge to modify it following tetromino's suggestions, and this is now two years old problem :/ )
Comment 25 Pacho Ramos gentoo-dev 2013-09-29 08:39:54 UTC
Will handle this directly on upstream bug as looks like they don't like this patch so much :(