Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 239291 - =app-admin/logrotate-3.7.2 sefaults in rotateSingleLog at logrotate.c:723
Summary: =app-admin/logrotate-3.7.2 sefaults in rotateSingleLog at logrotate.c:723
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: High normal
Assignee: Chema Alonso Josa (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-01 20:52 UTC by Muelli
Modified: 2015-11-26 12:16 UTC (History)
0 users

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 Muelli 2008-10-01 20:52:56 UTC
meatbox etc # gdb /usr/sbin/logrotate #-d -v /etc/logrotate.conf 
GNU gdb 6.7.1
Copyright (C) 2007 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"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) r -d -v /etc/logrotate.conf 
Starting program: /usr/sbin/logrotate -d -v /etc/logrotate.conf
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7d1bc4b70000
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file apache2
reading config info for /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log 
reading config info for /var/log/apache2/*log 
reading config file elog-save-summary
reading config info for /var/log/portage/elog/summary.log 
reading config file emerge
reading config info for /var/log/portage/*.log 
reading config info for /var/log/portage/elog/*.log 
reading config file mysql
reading config info for /var/log/mysql/mysql.err /var/log/mysql/mysql.log /var/log/mysql/mysqld.err 
reading config file syslog-ng
reading config info for /var/log/debug /var/log/syslog /var/log/kern.log 
reading config info for /var/log/cron.log /var/log/daemon.log /var/log/lpr.log /var/log/uucp.log 
reading config info for /var/log/user.log 
reading config info for /var/log/news/news.crit /var/log/news/news.err /var/log/news/news.notice 
reading config info for /var/log/mail.log /var/log/mail.info /var/log/mail.err /var/log/mail.warn 
reading config info for /var/log/avc.log /var/log/audit.log /var/log/pax.log /var/log/grsec.log 
reading config info for /var/log/auth.log 
reading config info for /var/log/messages 
reading config file thttpd
reading config info for /var/log/thttpd.log 
reading config file tor
reading config info for /var/log/tor/*.log 
reading config info for /var/log/wtmp 

Handling 17 logs

rotating pattern: /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log  weekly (4 rotations)
empty log files are not rotated, old logs mailed to root@cryptobitch.de
considering log /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log
  log needs rotating
rotating log /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log, log->rotateCount is 4

Program received signal SIGSEGV, Segmentation fault.
0x00000000004040c0 in rotateSingleLog (log=0x6211a0, logNum=0, 
    state=0x37f96952f450) at logrotate.c:723
723     logrotate.c: No such file or directory.
        in logrotate.c
(gdb) bt full
#0  0x00000000004040c0 in rotateSingleLog (log=0x6211a0, logNum=0,
    state=0x37f96952f450) at logrotate.c:723
        mailFilename = 0x41800000000 <Address 0x41800000000 out of bounds>
        fst_buf = {st_dev = 2051, st_ino = 2186182, st_nlink = 1,
  st_mode = 33188, st_uid = 0, st_gid = 81, pad0 = 0, st_rdev = 0,
  st_size = 36809, st_blksize = 4096, st_blocks = 72, st_atim = {
    tv_sec = 1219540203, tv_nsec = 0}, st_mtim = {tv_sec = 1219540204,
    tv_nsec = 0}, st_ctim = {tv_sec = 1221959402, tv_nsec = 0}, __unused = {0,
    0, 0}}
        now = {tm_sec = 32, tm_min = 38, tm_hour = 22, tm_mday = 1,
  tm_mon = 9, tm_year = 108, tm_wday = 3, tm_yday = 274, tm_isdst = 1,
  tm_gmtoff = 7200, tm_zone = 0x61d2a0 "CEST"}
        oldName = 0x7d1bc4a9ed40 "/srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log.5.gz"
        newName = 0x7d1bc4a9ec60 " \vb"
        disposeName = 0x7d1bc4a9eb80 "�p\016�"
        finalName = 0x37f9689f3e2e "\205�u^1�\203=\025�,"
        tmp = 0x0
        compext = 0x40a68f ".gz"
        fileext = 0x409dc2 ""
        hasErrors = 0
        i = 1
        fd = 0
---Type <return> to continue, or q <return> to quit---
        createUid = 0
        createGid = 4202272
        createMode = 0
        baseName = 0x620b20 "tor-or-anonproxy.cryptobitch.de-access_log"
        dirName = 0x636be0 "/srv/www/tor-or-anonproxy.cryptobitch.de/logs"
        firstRotated = 0x7d1bc4a9eaf0 ""
        glob_pattern = 0x48cc647d <Address 0x48cc647d out of bounds>
        globResult = {gl_pathc = 0, gl_pathv = 0x48e3dfc8, 
  gl_offs = 137558217060752, gl_flags = 1754903541, 
  gl_closedir = 0x37f968cbddc0, gl_readdir = 0x37f9689f33c8, gl_opendir = 0x1, 
  gl_lstat = 0x1, gl_stat = 0x8e}
        rc = 38
        alloc_size = 196
        rotateCount = 4
        logStart = 1
#1  0x000000000040510a in rotateLogSet (log=0x6211a0, sip=0x7d1bc4a9f370, 
    force=0) at logrotate.c:1079
        i = 0
        hasErrors = 0
        numRotated = 1
        state = (logState *) 0x37f96952f450
#2  0x0000000000405d31 in main (argc=4, argv=0x7d1bc4a9f558)
    at logrotate.c:1376
---Type <return> to continue, or q <return> to quit---
        createUid = 0
        createGid = 4202272
        createMode = 0
        baseName = 0x620b20 "tor-or-anonproxy.cryptobitch.de-access_log"
        dirName = 0x636be0 "/srv/www/tor-or-anonproxy.cryptobitch.de/logs"
        firstRotated = 0x7d1bc4a9eaf0 ""
        glob_pattern = 0x48cc647d <Address 0x48cc647d out of bounds>
        globResult = {gl_pathc = 0, gl_pathv = 0x48e3dfc8, 
  gl_offs = 137558217060752, gl_flags = 1754903541, 
  gl_closedir = 0x37f968cbddc0, gl_readdir = 0x37f9689f33c8, gl_opendir = 0x1, 
  gl_lstat = 0x1, gl_stat = 0x8e}
        rc = 38
        alloc_size = 196
        rotateCount = 4
        logStart = 1
#1  0x000000000040510a in rotateLogSet (log=0x6211a0, sip=0x7d1bc4a9f370, 
    force=0) at logrotate.c:1079
        i = 0
        hasErrors = 0
        numRotated = 1
        state = (logState *) 0x37f96952f450
#2  0x0000000000405d31 in main (argc=4, argv=0x7d1bc4a9f558)
    at logrotate.c:1376
---Type <return> to continue, or q <return> to quit---
        defConfig = {pattern = 0x0, files = 0x0, numFiles = 0, oldDir = 0x0, 
  criterium = ROT_WEEKLY, threshhold = 1048576, rotateCount = 4, 
  rotateAge = 90, logStart = -1, pre = 0x0, post = 0x0, first = 0x0, 
  last = 0x0, logAddress = 0x0, extension = 0x0, 
  compress_prog = 0x40a679 "/bin/gzip", 
  uncompress_prog = 0x40a683 "/bin/gunzip", compress_ext = 0x40a68f ".gz", 
  rotatePattern = 0x0, flags = 577, createMode = 4294967295, 
  createUid = 4294967295, createGid = 4294967295, compress_options_list = 0x0, 
  compress_options_count = 0}
        numLogs = 17
        force = 0
        logs = (logInfo *) 0x6211a0
        si = {states = 0x37f9694f8010, numStates = 1624}
        stateFile = 0x40a693 "/var/lib/logrotate.status"
        i = 0
        rc = 0
        arg = -1
        files = (const char **) 0x61bfe0
        file = (const char **) 0x61bfe8
        optCon = (poptContext) 0x61bcd0
        options = {{longName = 0x40a6ad "debug", shortName = 100 'd', 
    argInfo = 0, arg = 0x0, val = 100, 
    descrip = 0x40a6b8 "Don't do anything, just test (implies -v)", 
---Type <return> to continue, or q <return> to quit---
    argDescrip = 0x0}, {longName = 0x40a6e2 "force", shortName = 102 'f', 
    argInfo = 0, arg = 0x7d1bc4a9f388, val = 0, 
    descrip = 0x40a6e8 "Force file rotation", argDescrip = 0x0}, {
    longName = 0x40a6fc "mail", shortName = 109 'm', argInfo = 1, 
    arg = 0x60c298, val = 0, 
    descrip = 0x40a708 "Command to send mail (instead of `/bin/mail')", 
    argDescrip = 0x40a736 "command"}, {longName = 0x40a73e "state", 
    shortName = 115 's', argInfo = 1, arg = 0x7d1bc4a9f368, val = 0, 
    descrip = 0x40a744 "Path of state file", 
    argDescrip = 0x40a757 "statefile"}, {longName = 0x40a761 "verbose", 
    shortName = 118 'v', argInfo = 0, arg = 0x0, val = 118, 
    descrip = 0x40a770 "Display messages during rotation", argDescrip = 0x0}, {
    longName = 0x0, shortName = 0 '\0', argInfo = 4, arg = 0x60c300, val = 0, 
    descrip = 0x40a791 "Help options:", argDescrip = 0x0}, {longName = 0x0, 
    shortName = 0 '\0', argInfo = 0, arg = 0x0, val = 0, descrip = 0x0, 
    argDescrip = 0x0}}
#3  0x000037f968985b74 in ?? ()
No symbol table info available.
#4  0x0000000000401da0 in ?? ()
No symbol table info available.
#5  0x00007d1bc4a9f558 in ?? ()
No symbol table info available.
#6  0x0000000400000000 in ?? ()
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#7  0x000000000040592b in readState (stateFilename=Cannot access memory at address 0xfffffffffffffb28
) at logrotate.c:1283
        f = (FILE *) Cannot access memory at address 0xffffffffffffffe0
(gdb) 

Interesting, that I can run logrotate on the config which handles this apache log file.

(gdb) r -d -v /etc/logrotate.d/apache2
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /usr/sbin/logrotate -d -v /etc/logrotate.d/apache2
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x772f8838f000
reading config file /etc/logrotate.d/apache2
reading config info for /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log 
reading config info for /var/log/apache2/*log 

Handling 2 logs

rotating pattern: /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log  1048576 bytes (no old logs will be kept)
empty log files are not rotated, old logs mailed to root@cryptobitch.de
considering log /srv/www/tor-or-anonproxy.cryptobitch.de/logs/tor-or-anonproxy.cryptobitch.de-access_log
  log does not need rotating
[...]
Program exited normally

A crashing configuratino is the following:
/path/to/logfile {
  maxage 7
}


When commenting maxage, it doesn't crash.
Comment 1 Muelli 2008-10-01 20:53:36 UTC
Portage 2.1.4.4 (hardened/amd64, gcc-4.1.1, glibc-2.6.1-r0, 2.6.23-hardened-r7 x86_64)
=================================================================
System uname: 2.6.23-hardened-r7 x86_64 AMD Athlon(tm) 64 Processor 3800+
Timestamp of tree: Sat, 27 Sep 2008 02:15:05 +0000
ccache version 2.3 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r14
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.3
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=athlon64 -fomit-frame-pointer -ggdb -g3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -march=athlon64 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed"
LINGUAS="en de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
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.europe.gentoo.org/gentoo-portage"
USE="16bit acl acpi amd amd64 amuled apache2 audiofile auth authdaemond bash-completion bcmath berkdb buttons bzip2 bzlib cacheemu cairo calendar ccache cdb cgi chroot clamav cli cpulimit cracklib crypt css ctype curl cvsgraph datadir dedicated dhcp ecc edl escreen ethereal etwin exif expat extraengine extras fat firefox flood ftp fuse gd gdbm geoip ginac glibc-omitfp gnutls gpg gpgme gzip hardened hardenedphp hash hbci howl hpn html http httpd hub icq id3 idn imagemagick imap insecure-drivers ipppd irc isdn jabber jasper javascript john jpeg jpeg2k justify lame latex libclamav mail maildir maildrop mailwrapper math md5sum memlimit mhash midi mime mjpeg mod mod_irc mod_muc mod_pubsub mode-owner moznocompose moznoirc moznomail mozxmlterm mp4 mp4live mpeg2 mpeg4 mplayer mpm-itk msn msnextras multipleip multiuser mysql mysqli ncurses netboot nfs nls nntp no-old-linux nogg nptl nptlonly ntfs ntlm numarray numeric oav offensive on-the-fly-crypt openssl oscar pam pam_chroot pcre php pic png posix postfix preview-latex python quotas rdesktop readline recode reflection reiserfs remote roundrobin rss ruby sasl screen semanticfix sendfile sensord serial session sftp sftplogging shaper silc simplexml skey slang smime sms sockets socks5 softquota speex spell spl sql sqlite ssl subversion suhosin svg svn-mirror svnserve tcpd tetex thumbnail tidy tiff tokenizer transcode transparent-proxy truetype unicode urandom usb utf8 vchroot vda vfat vhosts virtual virus-scan web wmf xchattext xml xsl xvid yahoo 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 auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="itk" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 mach64 mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 2 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-03-10 02:17:56 UTC
This no longer happens with 3.7.8
Comment 3 Lubos Katrinec 2010-09-01 17:51:26 UTC
(In reply to comment #2)
> This no longer happens with 3.7.8
> 

I use 3.7.8 and it still happens:

logrotate --force /var/log/messages /etc/logrotate.conf 
Segmentation fault
Comment 4 Lubos Katrinec 2010-09-01 19:03:54 UTC
(In reply to comment #3)
> 
> I use 3.7.8 and it still happens:
> 
> logrotate --force /var/log/messages /etc/logrotate.conf 
> Segmentation fault
> 

Oh, my shame.

I mistakely used log file instead of configuration file.
Sorry
Comment 5 Daniel Gryniewicz (RETIRED) gentoo-dev 2010-09-02 12:54:35 UTC
It probably shouldn't crash, tho.
Comment 6 Chema Alonso Josa (RETIRED) gentoo-dev 2015-11-26 12:16:16 UTC
Version 3.7.2 no longer in the tree.