RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Invalid (as in double) free using --with-libcpuinfo

From: Jeff Johnson <n3npq@mac.com>
Date: Fri 08 Apr 2011 - 00:42:06 CEST
Message-id: <A3D0161C-1ECB-4E6D-94DD-76EC08B885A1@mac.com>
Correction:

The "invalid" is an address that wasn't malloc'd passed to free.

Its *not* a double free or glibc would have complained bitterly.

Sorry for my confusion.

hth

73 de Jeff

On Apr 7, 2011, at 6:32 PM, Jeff Johnson wrote:

> I just happen to have this valgrind spewage so I'll pass it along:
> 
> ==8285== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 113 from 6)
> ==8285== 
> ==8285== 1 errors in context 1 of 8:
> ==8285== Invalid free() / delete / delete[]
> ==8285==    at 0x42697EE: rpmioFreePoolItem (rpmmalloc.c:205)
> ==8285==    by 0x41AE2D8: mireFreeAll (mire.c:102)
> ==8285==    by 0x40BF7CF: rpmFreeRpmrc (rpmrc.c:1005)
> ==8285==    by 0x4097415: rpmcliFini (poptALL.c:550)
> ==8285==    by 0x804B53D: main (rpmqv.c:1061)
> ==8285==  Address 0x548ed54 is 12 bytes inside a block of size 792 alloc'd
> ==8285==    at 0x40250AB: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==8285==    by 0x40BE27C: defaultMachine (rpmrc.c:616)
> ==8285==    by 0x40BEF59: rpmSetMachine (rpmrc.c:836)
> ==8285==    by 0x40BF2DE: rpmRebuildTargetVars.clone.0 (rpmrc.c:920)
> ==8285==    by 0x40BFB32: rpmReadConfigFiles (rpmrc.c:1108)
> ==8285==    by 0x409715B: rpmcliConfigured (poptALL.c:196)
> ==8285==    by 0x4097E19: rpmcliInit (poptALL.c:793)
> ==8285==    by 0x804AB85: main (rpmqv.c:385)
> 
> Line numbers are wrto rpm-5_4 code at this moment. rpm-5_3
> is likely almost exactly identical.
> 
> The issue isn't critical solely because rpm doesn't segfault
> on every exit. What's
> 
> But the above isn't "correct" either for several reasons,
> only one of which is libcpuinfo wire-up related (the refcounts
> on mire obejctes used both as an "object" and as an "array"
> are the fundamental design flaw which makes it rather tricky
> to get the reference counts Just Right. What's missing
> is a refcnt++ somewhere if this were a normal rpm object).
> 
> I will look when I get a chance. ATM, I am narrowly focussed on --json
> imports into a MongoDB somehow this week.
> 
> hth
> 
> 73 de Jeff
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> Developer Communication List                        rpm-devel@rpm5.org
Received on Fri Apr 8 00:42:11 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.