Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 327915 - app-arch/tar-1.23 produces seg fault
Summary: app-arch/tar-1.23 produces seg fault
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-12 12:33 UTC by Alen Pljesa
Modified: 2010-10-26 11:44 UTC (History)
2 users (show)

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


Attachments
emerge --info working tar version (emerge info tar 1.20.txt,4.71 KB, text/plain)
2010-07-12 12:55 UTC, Alen Pljesa
Details
emerge --info crashing tar version 1.23-r2 (emerge info tar 1.23-r2.txt,4.72 KB, text/plain)
2010-07-12 12:55 UTC, Alen Pljesa
Details
strace log (strace output.txt,5.64 KB, text/plain)
2010-07-12 12:56 UTC, Alen Pljesa
Details
changelog file for reproducing segfault (segfault.7z,235.05 KB, text/plain)
2010-07-19 09:03 UTC, Alen Pljesa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alen Pljesa 2010-07-12 12:33:16 UTC
Backup script terminates with segmentation fault if invoked with updated tar version 1.23-r2. After emerging 1.20 error disappears.

How tar is invoked:
tar -cjnS -g /mnt/backup/sys/$tarweek/$tarweek.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/$tarweek/$tartime.sys.tbz  /

Notes:
- Error only occurs on incremental backup with -g option, not at first run.
- Deleting changelog file to recreate it with new version did not help.
- Changing compression options did not help.



Reproducible: Always

Steps to Reproduce:
1. do a first backup with -g option
2. do a second with existing changelog file

But: backup script does 4 backups, only one of them crashes (according number of files/directories to backup the greatest)

Actual Results:  
/etc/cron.hourly/ax-backup.cron: line 47: 2789367 Segmentation fault   tar -cjnS -g /mnt/backup/sys/$tarweek/$tarweek.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/$tarweek/$tartime.sys.tbz  /



Expected Results:  
incremental backup (backup script works since 5 years)

I can submit a strace output, but not sure if helpful.

CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -msse4.1"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
Comment 1 Alen Pljesa 2010-07-12 12:55:31 UTC
Created attachment 238433 [details]
emerge --info working tar version
Comment 2 Alen Pljesa 2010-07-12 12:55:55 UTC
Created attachment 238435 [details]
emerge --info crashing tar version 1.23-r2
Comment 3 Alen Pljesa 2010-07-12 12:56:26 UTC
Created attachment 238437 [details]
strace log
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2010-07-12 23:48:34 UTC
A gdb backtrace would be useful.
Comment 5 Alen Pljesa 2010-07-13 07:20:41 UTC
Yes, but this is a production system, sorry no symbols...

katowice 201028 # gdb --args tar -cjnS -g /mnt/backup/sys/201028/201028.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/201028/20100713Tue0901.sys.tbz /

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
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/tar...(no debugging symbols found)...done.
(gdb) run
Starting program: /bin/tar -cjnS -g /mnt/backup/sys/201028/201028.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/201028/20100713Tue0901.sys.tbz /
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x000000000042bcb0 in ?? ()
(gdb) backtrace
#0  0x000000000042bcb0 in ?? ()
#1  0x000000000042c096 in ?? ()
#2  0x000000000042c7d6 in ?? ()
#3  0x0000000000412571 in ?? ()
#4  0x0000000000413ba3 in ?? ()
#5  0x00000000004184ab in ?? ()
#6  0x000000000040bd12 in ?? ()
#7  0x000000000041d45d in ?? ()
#8  0x00007ffff787ebbd in __libc_start_main () from /lib/libc.so.6
#9  0x00000000004043b9 in ?? ()
#10 0x00007fffffffe2c8 in ?? ()
#11 0x000000000000001c in ?? ()
#12 0x0000000000000009 in ?? ()
#13 0x00007fffffffe557 in ?? ()
#14 0x00007fffffffe560 in ?? ()
#15 0x00007fffffffe566 in ?? ()
#16 0x00007fffffffe569 in ?? ()
#17 0x00007fffffffe595 in ?? ()
#18 0x00007fffffffe5a4 in ?? ()
#19 0x00007fffffffe5bc in ?? ()
#20 0x00007fffffffe5bf in ?? ()
#21 0x00007fffffffe5ee in ?? ()
#22 0x0000000000000000 in ?? ()
(gdb) info frame
Stack level 0, frame at 0x7fffffffde70:
 rip = 0x42bcb0; saved rip 0x42c096
 called by frame at 0x7fffffffdea0
 Arglist at 0x7fffffffde60, args:
 Locals at 0x7fffffffde60, Previous frame's sp is 0x7fffffffde70
 Saved registers:
  rip at 0x7fffffffde68
(gdb) info locals
No symbol table info available.
(gdb) info args
No symbol table info available.
(gdb)
Comment 6 Alen Pljesa 2010-07-13 07:25:58 UTC
And again manually compiled with -g option
(started ./configure and added -g to gcc options, so maybe without any gentoo specific patches)

kat src # gdb --args tar -cjnS -g /mnt/backup/sys/201028/201028.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/201028/20100713Tue0901.sys.tbz /

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
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 /tmp/tar-1.23/src/tar...done.
(gdb) run
Starting program: /tmp/tar-1.23/src/tar -cjnS -g /mnt/backup/sys/201028/201028.sys.changelog --exclude-from /etc/backup.sys.exclude -f /mnt/backup/sys/201028/20100713Tue0901.sys.tbz /
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
hash_string (string=0x0, n_buckets=11) at hash.c:427
427       for (; (ch = *string); string++)
(gdb) backtrace
#0  hash_string (string=0x0, n_buckets=11) at hash.c:427
#1  0x000000000042d436 in hash_find_entry (table=0x65c9d0, entry=0x65c7f0, bucket_head=0x7fffffffde98, delete=false) at hash.c:788
#2  0x000000000042db86 in hash_insert (table=0x65c9d0, entry=0x65c7f0) at hash.c:1042
#3  0x0000000000412a61 in note_directory (name=<value optimized out>, mtime=..., dev=2306, ino=2, nfs=false, found=false, contents=0x65b820 "N.rnd")
    at incremen.c:327
#4  0x00000000004141ec in read_incr_db_2 () at incremen.c:1267
#5  read_directory_file () at incremen.c:1343
#6  0x0000000000418d8a in collect_and_sort_names () at names.c:904
#7  0x000000000040beb2 in create_archive () at create.c:1283
#8  0x000000000041df3d in main (argc=<value optimized out>, argv=<value optimized out>) at tar.c:2605
(gdb) info frame
Stack level 0, frame at 0x7fffffffde60:
 rip = 0x42d050 in hash_string (hash.c:427); saved rip 0x42d436
 called by frame at 0x7fffffffde90
 source language c.
 Arglist at 0x7fffffffde50, args: string=0x0, n_buckets=11
 Locals at 0x7fffffffde50, Previous frame's sp is 0x7fffffffde60
 Saved registers:
  rip at 0x7fffffffde58
(gdb) info locals
value = 140737488346776
ch = <value optimized out>
(gdb) info args
string = 0x0
n_buckets = 11
(gdb)
Comment 7 SpanKY gentoo-dev 2010-07-18 20:19:23 UTC
please try and find an example we can reproduce with.  obviously we dont have access to your machines/mount points to back up those random dirs.
Comment 8 Alen Pljesa 2010-07-19 09:03:42 UTC
Created attachment 239353 [details]
changelog file for reproducing segfault
Comment 9 Alen Pljesa 2010-07-19 09:04:23 UTC
Yes... I figured out that my existing changelog file is sufficiant to reproduce, when it is loaded you get the segfault, independent of directory to backup, even with empty one.

./tar -cjnS -g segfault.changelog -f backup.tbz /var/empty/
Comment 10 SpanKY gentoo-dev 2010-07-19 21:58:43 UTC
great, that crashes on my system too
Comment 11 SpanKY gentoo-dev 2010-07-19 23:39:00 UTC
seems to be some fortify code catching it ... you should be able to workaround the issue in the mean time by emerging tar with:
CPPFLAGS=-U_FORTIFY_SOURCE emerge tar
Comment 12 Alen Pljesa 2010-07-20 08:35:03 UTC
Can not confirm on my system, building with CPPFLAGS=-U_FORTIFY_SOURCE does not help. For the gdb backtrace I used a version with -g -O0 which AFAIK inherits CPPFLAGS=-U_FORTIFY_SOURCE=0.
I configured my backup script to use old tar-1.20 for production backups, so this issue is not urgent.
Comment 13 Michael Weber (RETIRED) gentoo-dev 2010-07-21 08:25:32 UTC
i see this during emerge, too.
Comment 14 Sergey Klyaznik 2010-07-27 12:54:54 UTC
The same bug on 5 of my systems too, tar invoked as 

tar --create --gzip --sparse --listed-incremental=/var/tmp/dumpinfo '--exclude=/proc/*' '--exclude=/sys/*' '--exclude=/var/log/*.gz' '--exclude=/var/lib/mysql/billing_safe/*' /

When /var/tmp/dumpinfo is empty or deleted all works fine. tar-1.20 works as expected. Please fix it.

emerge --info
Portage 2.1.8.3 (hardened/linux/x86/10.0, gcc-4.3.4, glibc-2.11.2-r0, 2.6.28-hardened-r9 i686)
=================================================================
System uname: Linux-2.6.28-hardened-r9-i686-Intel-R-_Xeon-R-_CPU_E5504_@_2.00GHz-with-gentoo-1.12.13
Timestamp of tree: Mon, 05 Jul 2010 08:00:16 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.5-r2, 3.1.2-r3
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.65
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles"
LANG="ru_RU.UTF-8"
LC_ALL=""
LDFLAGS="-Wl,-O1"
LINGUAS="ru en"
MAKEOPTS="-j9"
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.gentoo.org/gentoo-portage"
USE="acl bash-completion berkdb bzip2 cli cracklib crypt cups cxx dri gdbm hardened iconv logrotate modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pic pppd python readline reflection session spl ssl sysfs syslog tcpd threads unicode urandom x86 zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1    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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel         mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage   siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware     voodoo" 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, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 15 Alex Efros 2010-08-01 07:29:36 UTC
Here is reproducible way to get this bug (at least, it works on several my systems):

# mkdir -p /tmp/tarbug/xxx/xxxxxxxxxxxx/xxx
# touch /tmp/tarbug/xxx/xxxxxxxxxxxx/xxx/xxxxxx
# ln -s xxxxxxxxxxxx /tmp/tarbug/xxx/xxxxxx
# tar -c -g /tmp/tarbug/x.snap -f /tmp/tarbug/x.tar /tmp/tarbug/xxx/xxxxxx /tmp/tarbug/xxx/xxxxxx /tmp/tarbug/xxx/xxxxxx
Segmentation fault

Directory /tmp/tarbug can be any, but xx's path must be exactly same (if you shorten xx's dir or file names by one symbol there will be no segfault.

tar-1.20 works ok on my system, this bug only in 1.23-r2.
Comment 16 Alex Efros 2010-08-01 07:52:24 UTC
I think 1.23-r2 should be immediately masked in portage, because major feature is broken (so, severity of this bug should be changed to 'major') and this may result in broken backups for a lot of people (and chances are most of them didn't notice broken backups until it will be too late).
Comment 17 SpanKY gentoo-dev 2010-10-25 05:17:06 UTC
should be fixed with tar-1.24
Comment 18 Alen Pljesa 2010-10-26 11:35:00 UTC
(In reply to comment #17)
> should be fixed with tar-1.24
> 

1.24 does not emerge without intervention. Should I open a new bug for this?

...
checking whether mknod can create fifo without root privileges... configure: error: in `/var/tmp/portage/app-arch/tar-1.24/work/tar-1.24':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details.

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/app-arch/tar-1.24/work/tar-1.24/config.log
 * ERROR: app-arch/tar-1.24 failed:
 *   econf failed
 *
 * Call stack:
 *     ebuild.sh, line   54:  Called src_configure
 *   environment, line 2642:  Called econf '--enable-backup-scripts' '--bindir=/bin' '--libexecdir=/usr/sbin' '--disable-nls'
 *     ebuild.sh, line  544:  Called die
 * The specific snippet of code:
 *                      die "econf failed"
 *
 * If you need support, post the output of 'emerge --info =app-arch/tar-1.24',
 * the complete build log and the output of 'emerge -pqv =app-arch/tar-1.24'.
 * The complete build log is located at '/var/log/ebuild/app-arch:tar-1.24:20101026-112505.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-arch/tar-1.24/temp/environment'.
 * S: '/var/tmp/portage/app-arch/tar-1.24/work/tar-1.24'

>>> Failed to emerge app-arch/tar-1.24, Log file:
Comment 19 Samuli Suominen (RETIRED) gentoo-dev 2010-10-26 11:44:50 UTC
(In reply to comment #18)
> 1.24 does not emerge without intervention. Should I open a new bug for this?
> FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)

Don't try to hijack old closed bugs for unrelated issues, and search bugzilla first, see bug 342593 ->