bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] bug in tar 1.13.9x


From: Eric Warmenhoven
Subject: Re: [Bug-tar] bug in tar 1.13.9x
Date: Sat, 3 Apr 2004 23:43:40 -0800
User-agent: Mutt/1.5.5.1+cvs20040105i

I figured out what it is. You can't free() a valloc()'ed area with
MALLOC_CHECK_ set to 2 (at least, not in debian sid). From the valloc
man page:

POSIX requires that memory obtained from posix_memalign() can be freed
using free(). Some systems provide no way to reclaim memory allocated
with memalign() or valloc() (because one can only pass to free() a
pointer gotten from malloc(), while e.g. memalign() would call malloc()
and then align the obtained value). GNU libc allows memory obtained from
any of these three routines to be reclaimed with free().

Removing the free(record_start) in close_archive fixed it for me (as did
changing the valloc to calloc).

Thanks,
Eric

On Thu, Apr 01, 2004 at 12:34:39AM -0800, Eric Warmenhoven wrote:
> On Tue, Mar 30, 2004 at 08:45:36AM +0300, Sergey Poznyakoff wrote:
> > 
> > > With every tar file I've tried, when I have the environment variable
> > > MALLOC_CHECK_ set to 2, tar dies with SIGABRT:
> > 
> > I wasn't able to reproduce this with the current CVS version. Could
> > you try it?
> 
> Actually I was able to reproduce it with the current CVS. I've attached
> a backtrace:
> 
> (gdb) set args jxf ../../tar-1.13.93.tar.bz2
> (gdb) run
> Starting program: /users/home24/ewarmenh/src/tar/tar/src/tar jxf
> ../../tar-1.13.93.tar.bz2
> [New Thread 16384 (LWP 18205)]
> Detaching after fork from child process 18208.
> 
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 16384 (LWP 18205)]
> 0x40059571 in kill () from /lib/libc.so.6
> (gdb) bt
> #0  0x40059571 in kill () from /lib/libc.so.6
> #1  0x4016b761 in pthread_kill () from /lib/libpthread.so.0
> #2  0x4016ba6b in raise () from /lib/libpthread.so.0
> #3  0x40059324 in raise () from /lib/libc.so.6
> #4  0x4005a838 in abort () from /lib/libc.so.6
> #5  0x4009fd74 in __libc_malloc_pthread_startup () from /lib/libc.so.6
> #6  0x400a0f65 in free () from /lib/libc.so.6
> #7  0x0804bfc8 in close_archive () at buffer.c:914
> #8  0x08055ad5 in read_and (do_something=0x8051990 <extract_archive>) at
>     list.c:186
> #9  0x08060495 in main (argc=3, argv=0xbfffde54) at tar.c:1536
> (gdb) frame 7
> #7  0x0804bfc8 in close_archive () at buffer.c:914
> 914       free (multi_volume_option ? record_start - 2 : record_start);
> (gdb) print multi_volume_option
> $1 = false
> 
> > 
> > Regards,
> > Sergey
> 
> Thanks,
> Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]