Re: ifconfig dumps core and gdb uses an undefined symbol

From: Alexander Chernikov <melifaro_at_FreeBSD.org>
Date: Wed, 14 Jun 2023 10:40:58 UTC

> On 14 Jun 2023, at 11:35, Gary Jennejohn <garyj@gmx.de> wrote:
> 
> On Wed, 14 Jun 2023 11:05:31 +0100
> Alexander Chernikov <melifaro@FreeBSD.org> wrote:
> 
>>> On 14 Jun 2023, at 10:53, Gary Jennejohn <garyj@gmx.de> wrote:
>>> 
>>> On Wed, 14 Jun 2023 09:01:35 +0000
>>> Gary Jennejohn <garyj@gmx.de <mailto:garyj@gmx.de>> wrote:
>>> 
>>>> On Wed, 14 Jun 2023 09:09:04 +0100
>>>> Alexander Chernikov <melifaro@FreeBSD.org> wrote:
>>>> 
>>>>>> On 14 Jun 2023, at 08:59, Gary Jennejohn <garyj@gmx.de> wrote:
>>>>> Hi Gary,
>>>>>> 
>>>>>> So, now I have a new problem with current.
>>>>>> 
>>>>>> I just now updated my current sources and ran buildworld and buildkernel,
>>>>>> since Gleb fixed the WITHOUT_PF problem.
>>>>>> 
>>>>>> After installing the new world and kernel I see that ifconfig is dumping
>>>>>> a core, apparently when it tries to show lo0, since re0 is correctly
>>>>>> shown:
>>>>>> 
>>>>>> ifconfig
>>>>>> re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 4088 options=82098<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
>>>>>>     ether redacted
>>>>>>     inet 192.168.178.XXX netmask 0xffffff00 broadcast 192.168.178.255
>>>>>> Segmentation fault (core dumped)
>>>>> Could you please try to narrow down the crashing command? e.g.
>>>>> Ifconfig lo0
>>>>> Ifconfig lo0 net
>>>>> Ifconfig lo0 inet6
>>>>> Could you try to rebuild ifconfig w/o netlink (e.g. set WITHOUT_NETLINK=yes in the make.conf & make -C sbin/ifconfig clean all install) and see if the new binary works?
>>>>> 
>>>> 
>>>> I already have WITHOUT_NETLINK=yes in my /etc/src.conf.
>>>> 
>>>> I didn't install ifconfig. I simply started it from the build directory.
>>>> 
>>>> ifconfig lo0 shows the settings for lo0 and then dumps core.
>>>> 
>>> 
>>> After your most recent changes "ifconfig re0" and "ifconfg lo0" don't
>>> result in any errors.  But "ifconfig" alone still results in a core
>>> dump, which per gdb is happening in the strlcpy() call at in_status_tunnel()
>>> in af_inet.c.
>> Indeed.
>> 
>> diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
>> index d30d3e1909ae..6a80ad5763b2 100644
>> --- a/sbin/ifconfig/ifconfig.c
>> +++ b/sbin/ifconfig/ifconfig.c
>> @@ -822,6 +822,7 @@ list_interfaces_ioctl(if_ctx *ctx)
>>                        continue;
>>                if (!group_member(ifa->ifa_name, args->matchgroup, args->nogroup))
>>                        continue;
>> +               ctx->ifname = cp;
>>                /*
>>                 * Are we just listing the interfaces?
>>                 */
>> 
>> Does this one fix the crash?
>>> 
> 
> YES!
Should be fixed by 52ff8883185a then.
Thank you for the report and sorry for the breakage!
> 
> --
> Gary Jennejohn
>