Hi Denys and pramod,
I'm able to reproduce the udhcpc6 segfault on an ARM9 machine. The
problem occurs when returning
from re-allocating new memory in the new_env()-function:
udhcpc6 (v1.20.2) started
udhcpc6: xrealloc_vector_helper(): vector: 0x85040
new_env(): client6_data.env_ptr:0x85040
fill_envp(): client6_data.env_ptr: 0x40000850
Segmentation fault
I think the problem is memory-alignment related.
Perhaps move_from_unaligned32 from platform.h could help?
Maybe someone with more memory-alignment background has an idea.
Best regards,
Joerg
> Hi Denys,
> After enabling the print i am getting following:
> udhcpc6 (v1.20.2) started
> udhcpc6: curr:0x480010e0
> Segmentation fault
>
> Warm Regards,
> pramod
> On Wed, Aug 15, 2012 at 10:27 PM, Denys Vlasenko
> <vda.linux at googlemail.com> wrote:
>> On Tue, Aug 14, 2012 at 4:06 PM, Pramod Bhagwat <prbhagwat at gmail.com>
>> wrote:
>>> static char **fill_envp(struct d6_packet *packet)
>>> {
>>> char **envp, **curr;
>>>
>>> client6_data.env_ptr = NULL;
>>> client6_data.env_idx = 0;
>>>
>>> *new_env() = xasprintf("interface=%s", client_config.interface);
>>>
>>> if (packet)
>>> option_to_env(packet->d6_options, packet->d6_options +
>>> sizeof(packet->d6_options));
>>>
>>> envp = curr = client6_data.env_ptr;
>>
>> bb_error_msg("curr:%p", curr);
>> bb_error_msg("curr[0]:%p", curr[0]);
>>
>>> while (*curr)
>>
>> {
>> bb_error_msg("*curr:%p", *curr);
>> bb_error_msg("*curr:'%s'", *curr);
>>
>>> putenv(*curr++);
>>
>> }
>>
>>>
>>> return envp;
>>> }
>>>
>>> In the above code while accessing curr pointer it is giving the
>>> segmentation fault.
>>> But client6_data.env_ptr is not NULL.
>>
>> Please add bb_error_msg's as shown above, run udhcpc6 again and
>> let me know what it printed.
>>
>> --
>> vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox