ash r21030 broken?

Ralf Friedl Ralf.Friedl at online.de
Wed Feb 20 17:27:02 UTC 2008



Cristian Ionescu-Idbohrn wrote:
> On Wed, 20 Feb 2008, Denys Vlasenko wrote:
>   
>> And if it still fails, make both alloc() functions zero out
>> allocated block:
>>
>> static void *
>> ckmalloc(size_t nbytes)
>> {
>> -       return ckrealloc(NULL, nbytes);
>> +       return memset(ckrealloc(NULL, nbytes), 0, nbytes);
>> }
>>
>> static void *
>> stalloc(size_t nbytes)
>> {
>> ...
>>         g_stacknleft -= aligned;
>> +       memset(p, 0, nbytes);
>>         return p;
>> }
>>
>> If this helps, then it's only a matter of finding a ckmalloc/stalloc
>> which really needs to be ckzalloc/stzalloc.
>>     
>
> Sorry Denys :(
> I've no access to my embedded system now and the comming 2+ weeks.
> Holidays ;-)
>
> Maybe a 16Mb RAM qemu could help nail down these problems, in absence of a
> low memory embeded system, as it seems one of the factors that provokes
> the errors may be low memory, but I'm just guessing.

What about initializing the memory to non-zero values? That should help 
to find uninitialized references.

static void *
ckmalloc(size_t nbytes)
{
-       return ckrealloc(NULL, nbytes);
+       return memset(ckrealloc(NULL, nbytes), 0xDC, nbytes);
}

static void *
stalloc(size_t nbytes)
{
...
        g_stacknleft -= aligned;
+       memset(p, 0xDC, nbytes);
        return p;
}


Regards
Ralf Friedl



More information about the busybox mailing list