Running namecoind 13.2 for about two years. OpenBSD 6.1amd64 is the last
version which supports it.

On 6.2 I stuck with malloc() hardening. With no any malloc.conf options
I have these errors:

namecoind (4563) malloc():bogus pointer (double free?) 0xdfdfdfdfdfdfdfdf
namecoind (4563) free(): chunk is already free 0x1bc9981cae20

I get a bit different error while set 'S' to malloc.conf

ln -s 'S' /etc/malloc.conf

namecoind (2501) in free(): chunk canary corrupted 0x1ad4b3e5b3b0
0x2@0x2 (double free?)

Otto wrote that it means

overwrite of a buffer and/or a double free

Afterwards, I've searched on github.com for namecoin project using
malloc keyword, seems nothing changed since 13.2 in malloc functionality.

https://github.com/namecoin/namecoin-core/search?utf8=%E2%9C%93&q=malloc&type=

In two Cpp files developers initially reserved additional memory for
pointers plus allocation if I understand code right :

src/txmempool.h
<https://github.com/namecoin/namecoin-core/blob/60b5fb9339b5196b7c46e7fc04e6190560d3aff1/src/txmempool.h>

Showing the top match Last indexed Jan 6, 2018
return memusage::/Malloc/Usage(sizeof(CTransactionRef) + 6 *
sizeof(void*)) * queuedTx.size() + cachedInnerUsage;


src/txmempool.cpp
<https://github.com/namecoin/namecoin-core/blob/60b5fb9339b5196b7c46e7fc04e6190560d3aff1/src/txmempool.cpp>

Showing the top match Last indexed Jan 6, 2018
// Estimate the overhead of mapTx to be 15 pointers + an allocation, as
no exact formula for boost::multi_index_contained is implemented.

return memusage::/Malloc/Usage(sizeof(CTxMemPoolEntry) + 15 *
sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) +
memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) +
memusage::DynamicUsage(vTxHashes) + cachedInnerUsage;

Could somebody help to fix namecoin malloc() to latest malloc
restrictions in OpenBSD 6.2 ?

Thank you in advance.

Denis

On 1/22/2018 4:20 PM, Otto Moerbeek wrote:
> On Mon, Jan 22, 2018 at 03:20:42PM +0300, Denis wrote:
>
>> Otto,
>>
>> Thank you for your hint.
>>
>> I've set to ln -s 'S' /etc/malloc.conf and error is a bit different now:
>>
>> namecoind (2501) in free(): chunk canary corrupted 0x1ad4b3e5b3b0
>> 0x2@0x2 (double free?)
> This means that there's an overwrite of a buffer and/or a double free.
> Another indication that something is wrong with memory management.
> Talk to the developers of namecoind
>
>       -Otto
>
>> Denis
>>
>> On 1/21/2018 1:46 PM, Otto Moerbeek wrote:
>>> On Sun, Jan 21, 2018 at 11:21:12AM +0100, Otto Moerbeek wrote:
>>>
>>>> On Sun, Jan 21, 2018 at 12:41:50PM +0300, Denis wrote:
>>>>
>>>>> I used namecoin on 6.1amd64 statically builded from source using boost
>>>>> 1.61 library. All works pretty fine before upgrade to 6.2amd64.
>>>>>
>>>>> I have rebuilt the the same namecoin source with boost 1.61 lib 
>>>>> statically.
>>>>> After running it on OpenBSD6.2amd64 I see the error with malloc() and
>>>>> free() listed below:
>>>>>
>>>>> namecoind (4563) malloc():bogus pointer (double free?) 0xdfdfdfdfdfdfdfdf
>>>>> namecoind (4563) free(): chunk is already free 0x1bc9981cae20
>>>>>
>>>>> Is something changed in malloc() since than?
>>>>> How to get work statically built  namecoin on 6.2?
>>>>>
>>>>> Thank you for answer in advance.
>>>>>
>>>>> Denis
>>>> Yes, a few things changed, making malloc more strict.
>>>> This is almost certainly a bug wrt memory management in namecoind. 
>>>>
>>>>    -Otto
>>> To diagnose this further, you can play with malloc options. See man
>>> malloc.conf.
>>> e.g. run with option S, which is even more strict. That might give you
>>> a hint where the bug is.
>>>
>>>     -Otto
>>>

Reply via email to