Re: ifconfig dumps core and gdb uses an undefined symbol

From: Alexander Chernikov <melifaro_at_FreeBSD.org>
Date: Wed, 14 Jun 2023 09:17:51 UTC

> On 14 Jun 2023, at 10:01, Gary Jennejohn <garyj@gmx.de> wrote:
> 
> On Wed, 14 Jun 2023 09:09:04 +0100
> Alexander Chernikov <melifaro@FreeBSD.org <mailto: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.
> 
>>> 
>>> Unfortunately, I see this error message when I try to look at the core
>>> file with gdb:
>>> 
>>> gdb /sbin/ifconfig ifconfig.core
>>> ld-elf.so.1: Undefined symbol "rl_eof_found" referenced from COPY
>>> relocation in /usr/local/bin/gdb
>> Not a specialist here, but if you could build the binary with debug
>> (make DEBUG_FLAGS=-O0 -g3 sbin/ifconfig clean all install) & share the
>> binary & core with me, I could take a look on what?s happening.
>>> 
> 
> I compiled gbd under /usr/ports and it now works, although it's emitting
> some weird errors.
> 
> -O0 -g3 removes too much and gdb shows no useful information.
> 
> With just -g3 I get this output from gdb after running the newly compiled
> ifconfig:
> 
> Program terminated with signal SIGSEGV, Segmentation fault
> warning: Section `.reg-xstate/100294' in core file too small.
> #0  lagg_status (ctx=0x2f051660ba00) at /usr/src/sbin/ifconfig/iflagg.c:223
> 223             const int verbose = ctx->args->verbose;
> (gdb) bt
> #0  lagg_status (ctx=0x2f051660ba00) at /usr/src/sbin/ifconfig/iflagg.c:223
> #1  0x00002efcf610ea55 in af_other_status (ctx=0x2f051660ba00)
>    at /usr/src/sbin/ifconfig/ifconfig.c:964
> #2  status (args=0x2f051660ba70, ifa=0x2f051a2f2000, sdl=<optimized out>)
>    at /usr/src/sbin/ifconfig/ifconfig.c:1788
> #3  list_interfaces_ioctl (args=0x2f051660ba70)
>    at /usr/src/sbin/ifconfig/ifconfig.c:845
> #4  list_interfaces (args=0x2f051660ba70)
>    at /usr/src/sbin/ifconfig/ifconfig.c:428
> #5  main (ac=<optimized out>, av=<optimized out>)
>    at /usr/src/sbin/ifconfig/ifconfig.c:724
> (gdb)
> 
> I looked at ctx:
> 
> (gdb) p ctx
> $1 = (if_ctx *) 0x2f051660ba00
> (gdb) p/x *0x2f051660ba00
> $2 = 0x0 <==
> (gdb)
> 
> So, looks like the problem is in iflagg and ctx is NULL.
Ack. Does bbad5525fabf fix the issue?
> 
> --
> Gary Jennejohn