Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 301787 - sys-apps/util-linux-2.17: mount segfaults when mounting the cdrom
Summary: sys-apps/util-linux-2.17: mount segfaults when mounting the cdrom
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 301580 302068 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-22 00:43 UTC by Alec Meyers
Modified: 2010-02-09 01:55 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Meyers 2010-01-22 00:43:58 UTC
For some CDs mount throws a segmentation fault. The backtrace is below, when compiled with -O -ggdb.

Reproducible: Always

Steps to Reproduce:
1. # emerge -qpv util-linux
[ebuild   R   ] sys-apps/util-linux-2.17  USE="crypt perl unicode -loop-aes
-nls -old-linux (-selinux) -slang (-uclibc)"
2. Insert a disk into cdrom (not every cdrom segfaults)
3. # mount /dev/cdrom /mnt/cdrom
Actual Results:  
# gdb /bin/mount 
GNU gdb (Gentoo 7.0.1 p1) 7.0.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.           
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"   
and "show warranty" for details.                                             
This GDB was configured as "x86_64-pc-linux-gnu".                            
For bug reporting instructions, please see:                                  
<http://bugs.gentoo.org/>...                                                 
Reading symbols from /bin/mount...Reading symbols from /usr/lib64/debug/bin/mount.debug...done.                                                                 
(no debugging symbols found)...done.                                            
(gdb) r /dev/cdrom /mnt/cdrom
Starting program: /bin/mount /dev/cdrom /mnt/cdrom

Program received signal SIGSEGV, Segmentation fault.
probe_drbd (pr=0xcbb3e0, mag=<value optimized out>) at drbd.c:83
83              if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_08)
(gdb) bt
#0  probe_drbd (pr=0xcbb3e0, mag=<value optimized out>) at drbd.c:83
#1  0x00007f0189b2e523 in superblocks_probe (pr=0xcbb3e0, chn=0xcbb440)
    at superblocks.c:357
#2  0x00007f0189b2e789 in superblocks_safeprobe (pr=0xcbb3e0, chn=0xcbb440)
    at superblocks.c:406
#3  0x00007f0189b28ea0 in blkid_do_safeprobe (pr=0xcbb3e0) at probe.c:766
#4  0x000000000040ae26 in fsprobe_get_value (name=0x40e069 "TYPE",
    devname=0xcbb3a0 "/dev/sr0") at ../lib/fsprobe.c:142
#5  0x0000000000404f97 in guess_fstype_by_devname (
    spec0=<value optimized out>, node0=<value optimized out>,
    types0=<value optimized out>, opts0=<value optimized out>,
    ro=<value optimized out>, pass=<value optimized out>,
    freq=<value optimized out>) at mount.c:867
#6  guess_fstype_and_mount (spec0=<value optimized out>,
    node0=<value optimized out>, types0=<value optimized out>,
    opts0=<value optimized out>, ro=<value optimized out>,
    pass=<value optimized out>, freq=<value optimized out>) at mount.c:899
#7  try_mount_one (spec0=<value optimized out>, node0=<value optimized out>,
    types0=<value optimized out>, opts0=<value optimized out>,
    ro=<value optimized out>, pass=<value optimized out>,
    freq=<value optimized out>) at mount.c:1354
#8  0x0000000000405c4e in mount_one (spec=0x5 <Address 0x5 out of bounds>,
    node=<value optimized out>, types=0x0, fstabopts=<value optimized out>,
    cmdlineopts=0x0, pass=<value optimized out>, freq=<value optimized out>)
    at mount.c:1722
#9  0x0000000000406398 in main (argc=<value optimized out>,
    argv=<value optimized out>) at mount.c:2325


Expected Results:  
... not segfault?

# emerge --info  
Portage 2.2_rc61 (default/linux/amd64/10.0/no-multilib, gcc-4.4.2, glibc-2.11-r1, 2.6.32.3 x86_64)                                                              
=================================================================               
System uname: Linux-2.6.32.3-x86_64-Intel-R-_Core-TM-2_CPU_T5300_@_1.73GHz-with-gentoo-2.0.1                                                                    
Timestamp of tree: Thu, 21 Jan 2010 18:45:01 +0000                              
app-shells/bash:     4.0_p37                                                    
dev-java/java-config: 2.1.10                                                    
dev-lang/python:     2.6.4                                                      
dev-util/cmake:      2.8.0                                                      
sys-apps/baselayout: 2.0.1                                                      
sys-apps/openrc:     0.6.0-r1                                                   
sys-apps/sandbox:    2.2                                                        
sys-devel/autoconf:  2.13, 2.65                                                 
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1                                   
sys-devel/binutils:  2.20                                                       
sys-devel/gcc-config: 1.4.1                                                     
sys-devel/libtool:   2.2.6b                                                     
virtual/os-headers:  2.6.30-r1                                                  
ACCEPT_KEYWORDS="amd64 ~amd64"                                                  
ACCEPT_LICENSE="* -@EULA PUEL skype-eula dlj-1.1"                               
CBUILD="x86_64-pc-linux-gnu"                                                    
CFLAGS="-O2 -march=native -pipe -fno-ident -ggdb -floop-interchange -floop-strip-mine -floop-block"                                                             
CHOST="x86_64-pc-linux-gnu"                                                     
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"                      
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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 -march=native -pipe -fno-ident -ggdb -floop-interchange -floop-strip-mine -floop-block"                                                           
DISTDIR="/usr/portage/distfiles"                                                
FEATURES="assume-digests distlocks fixpackages news preserve-libs protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch"       
GENTOO_MIRRORS="http://gentoo.netnitco.net http://gentoo.osuosl.org/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://gentoo.chem.wisc.edu/gentoo"    
LDFLAGS="-Wl,-O1 -Wl,--as-needed"                                               
LINGUAS="en"                                                                    
MAKEOPTS="-j3"                                                                  
PKGDIR="/usr/portage/packages"                                                  
PORTAGE_COMPRESS="gzip"                                                         
PORTAGE_CONFIGROOT="/"                                                          
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"           
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/tree/official"
PORTDIR_OVERLAY="/usr/portage/tree/layman/kde /usr/portage/tree/local"
SYNC="rsync://rsync21.us.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi aio alsa amd64 audiofile avi bash-completion berkdb branding bzip2 cdparanoia cdr chm cli cracklib crypt css cups curl custom-optimization cxx dbus dell dirac dri dvd dvdr encode exif expat ffmpeg firefox flac foomaticdb fortran gdbm gif git gmp gpm gtk iconv icu imagemagick imlib inotify java5 java6 jpeg kde kdehiddenvisibility laptop latex lcms logrotate lqr lzma lzo mad mmx mmxext mng modules mp3 mp4 mpeg mplayer mudflap musepack ncurses nptl nptlonly nsplugin nvidia ogg opengl openmp openssl pam pch pcre perl plasma png ppds pppd python qt qt4 quicktime rar readline reflection resolvconf samba schroedinger session sndfile speex spell spl sqlite sqlite3 srt sse sse2 ssl ssse3 subversion svg sysfs tcpd theora threads tiff unicode usb v4l v4l2 vcd videos vorbis webkit wifi wmf x264 xcb xcomposite xorg xscreensaver xulrunner xv xvid xvmc xz zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" QEMU_SOFTMMU_TARGETS="arm ppc" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS_FLAGS
Comment 1 Peter Volkov (RETIRED) gentoo-dev 2010-01-26 16:28:34 UTC
Bug 302068 states, that 2.16.2 version works fine. There is no backtrace there, but I think it's duplicate of this one.
Comment 2 Peter Volkov (RETIRED) gentoo-dev 2010-01-26 16:29:03 UTC
*** Bug 302068 has been marked as a duplicate of this bug. ***
Comment 3 Peter Volkov (RETIRED) gentoo-dev 2010-01-26 17:18:51 UTC
*** Bug 301580 has been marked as a duplicate of this bug. ***
Comment 4 Alec Meyers 2010-01-26 23:53:22 UTC
Just wondering, anyone tried reproducing this on another distro to see if this is Gentoo-specific or if it's an upstream bug?
Comment 5 SpanKY gentoo-dev 2010-01-27 00:04:05 UTC
considering we dont apply any patches, it cant really be a Gentoo-specific issue

see if reading some amount of data out of /dev/sr0 into a file can trigger the segfault on the file alone:
dd if=/dev/sr0 of=foo count=1024
mount ./foo /mnt/cdrom

(might have to add -o loop there)
Comment 6 Guillaume Tissier 2010-01-27 14:47:26 UTC
(In reply to comment #5)
dd if=/dev/sr0 of=foo count=1024
dd: opening `/dev/sr0': No medium found

Comment 7 Guillaume Tissier 2010-01-27 14:54:36 UTC
Don't take care of Message #6, using wrong device :

# dd if=/dev/sr1 of=foo count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 1.02188 s, 513 kB/s

loop mount works fine

Mount device :
# mount /dev/sr1
Segmentation fault
Comment 8 Tom Kerremans 2010-01-29 11:16:27 UTC
I have the same problem with util-linux-2.15, compiled on an old Mandrake 10.2, gcc 3.4.3
When I mount the cd with the filesystem option '-t iso9660', it works. 
So it's definitely not Gentoo related.
Comment 9 SpanKY gentoo-dev 2010-01-29 16:13:26 UTC
does `blkid /dev/sr0` also crash ?
Comment 10 Alec Meyers 2010-01-29 18:32:39 UTC
(In reply to comment #9)
> does `blkid /dev/sr0` also crash ?
> 

Yes it does. And, as Tom noticed, with "-t iso9660" it actually mounts.

So, it looks like the actual problem is actually in blkid, not mount.
Comment 11 SpanKY gentoo-dev 2010-01-29 20:24:25 UTC
that's because using the -t option tells mount to skip the probe routines

if you `dd` in a chunk of the cd and run `blkid` on it, does it still segfault ?  that would be useful to have as an attachment for other people to reproduce the problem.
Comment 12 Alec Meyers 2010-01-29 21:27:28 UTC
Nope, running blkid on the image shows the label and the type, and does not segfault.
Comment 13 Jouni Rinne 2010-02-01 16:24:51 UTC
Just noticed that, too... I was trying to mount some encrypted cd's, and both mount and blkid segfaulted. I had an entry in /etc/fstab for those cd's to allow user mount, and it had 'auto' as a 'type' entry. I changed it to 'iso9660', and this allowed me to mount the cd's, although blkid still segfaulted (according to /var/log/messages). It USED to work fine some months ago...

emerge --info:
Portage 2.1.7.17 (default/linux/amd64/10.0, gcc-4.4.2, glibc-2.11-r1, 2.6.28-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.28-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8500_@_3.16GHz-with-gentoo-2.0.1
Timestamp of tree: Sun, 31 Jan 2010 17:15:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.10
dev-lang/python:     2.5.4-r2, 2.6.4-r1, 3.1.1-r1
dev-python/pycrypto: 2.1.0
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.0-r1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.0-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.5, 1.7.9-r2, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3, 2.20
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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 -march=nocona -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/"
LANG="fi_FI.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="fi"
MAKEOPTS="-j5"
PKGDIR="/usr/local/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 /var/lib/layman/pd-overlay /var/lib/layman/kde-sunset /var/lib/layman/lightscribe"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 audiofile avahi berkdb bluetooth bonjour bzip2 cairo cdinstall cli crypt cups curl cxx dbus dirac dri dv dvd dvdread encode exif ffmpeg flac fontforge fortran gdbm gif git gnome gnutls gpm gtk2 hal iconv id3tag ieee1394 imagemagick ipv6 jack joystick jpeg kde ladspa lash lcms libnotify lzo mad matroska mikmod mjpeg mmap mmx mmxext modules motif mp3 mp4 mpeg mtp mudflap multilib ncurses nls nptl nptlonly nsplugin ogg openexr opengl openmp osc pam pcre pdf perl phonon png pppd python qt3 qt3support qt4 quicktime readline reflection ruby scanner sdl semantic-desktop session smp sndfile sox speex spl sqlite sqlite3 sse sse2 ssl ssse3 svg sysfs tcpd theora tiff truetype unicode usb v4l v4l2 vorbis wavpack x264 xcb xine xinerama xml xorg xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="seq-dummy dummy virmidi mtpav mts64 serial-u16550 mpu401 loopback     portman2x4 ad1889 als300 als4000 ali5451 atiixp atiixp-modem au8810 au8820     au8830 azt3328 bt87x ca0106 cmipci cs4281 cs46xx cs5535audio darla20 gina20     layla20 darla24 gina24 layla24 mona mia echo3g indigo indigoio indigodj     emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel hdsp hdspm     ice1712 ice1724 intel8x0 intel8x0m korg1212 maestro3 mixart nm256 pcxhr     riptide rme32 rme96 rme9652 sonicvibes trident via82xx via82xx-modem vx222     ymfpci pdplus asihpi usb-audio usb-usx2y vxpocket pdaudiocf soc     aica emi26 emu1212 emu1616 emu1820" 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 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" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fi" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa fglrx radeon radeonhd" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 15 Alec Meyers 2010-02-05 16:18:48 UTC
(In reply to comment #14)
> Take a look at this fix:
> 
> http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=commitdiff;h=10f494e1a0ac09e144a42fcaeb72663674eb30fc
> 

Yep, that fixes it.
Comment 16 Gordon Schumacher 2010-02-09 00:53:47 UTC
I can verify that this occurs on some CDs - and only on some machines, in some circumstances... and indeed, running against a "dd" image works, as does anything other than a CD.
Comment 17 SpanKY gentoo-dev 2010-02-09 01:55:03 UTC
thanks, added that patch to util-linux-2.17-r1