Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jun 2023 11:05:31 +0100
From:      Alexander Chernikov <melifaro@FreeBSD.org>
To:        garyj@gmx.de
Cc:        current@freebsd.org
Subject:   Re: ifconfig dumps core and gdb uses an undefined symbol
Message-ID:  <D4A8FF85-D145-4205-B7D2-DE2F43DA7F42@FreeBSD.org>
In-Reply-To: <20230614115350.5e7386fa@ernst.home>
References:  <20230614095956.26234554@ernst.home> <7A98AD66-35D3-447B-B808-2A52E9AD28F3@FreeBSD.org> <20230614110135.15b928db@ernst.home> <20230614115350.5e7386fa@ernst.home>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]


> 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?
> 
> --
> Gary Jennejohn


[-- Attachment #2 --]
<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><br><blockquote type="cite"><div>On 14 Jun 2023, at 10:53, Gary Jennejohn &lt;garyj@gmx.de&gt; wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">On Wed, 14 Jun 2023 09:01:35 +0000</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Gary Jennejohn &lt;</span><a href="mailto:garyj@gmx.de" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">garyj@gmx.de</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">&gt; wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">On Wed, 14 Jun 2023 09:09:04 +0100<br>Alexander Chernikov &lt;melifaro@FreeBSD.org&gt; wrote:<br><br><blockquote type="cite"><blockquote type="cite">On 14 Jun 2023, at 08:59, Gary Jennejohn &lt;garyj@gmx.de&gt; wrote:<br></blockquote>Hi Gary,<br><blockquote type="cite"><br>So, now I have a new problem with current.<br><br>I just now updated my current sources and ran buildworld and buildkernel,<br>since Gleb fixed the WITHOUT_PF problem.<br><br>After installing the new world and kernel I see that ifconfig is dumping<br>a core, apparently when it tries to show lo0, since re0 is correctly<br>shown:<br><br>ifconfig<br>re0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 4088 options=82098&lt;VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ether redacted<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inet 192.168.178.XXX netmask 0xffffff00 broadcast 192.168.178.255<br>Segmentation fault (core dumped)<br></blockquote>Could you please try to narrow down the crashing command? e.g.<br>Ifconfig lo0<br>Ifconfig lo0 net<br>Ifconfig lo0 inet6<br>Could you try to rebuild ifconfig w/o netlink (e.g. set WITHOUT_NETLINK=yes in the make.conf &amp; make -C sbin/ifconfig clean all install) and see if the new binary works?<br><br></blockquote><br>I already have WITHOUT_NETLINK=yes in my /etc/src.conf.<br><br>I didn't install ifconfig. I simply started it from the build directory.<br><br>ifconfig lo0 shows the settings for lo0 and then dumps core.<br><br></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">After your most recent changes "ifconfig re0" and "ifconfg lo0" don't</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">result in any errors. &nbsp;But "ifconfig" alone still results in a core</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">dump, which per gdb is happening in the strlcpy() call at in_status_tunnel()</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">in af_inet.c.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div></blockquote>Indeed.</div><div><br><div><div>diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c</div><div>index d30d3e1909ae..6a80ad5763b2 100644</div><div>--- a/sbin/ifconfig/ifconfig.c</div><div>+++ b/sbin/ifconfig/ifconfig.c</div><div>@@ -822,6 +822,7 @@ list_interfaces_ioctl(if_ctx *ctx)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!group_member(ifa-&gt;ifa_name, args-&gt;matchgroup, args-&gt;nogroup))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctx-&gt;ifname = cp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Are we just listing the interfaces?</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</div></div><div><br></div><div>Does this one fix the crash?</div><blockquote type="cite"><div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">--</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Gary Jennejohn</span></div></blockquote></div><br></body></html>
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D4A8FF85-D145-4205-B7D2-DE2F43DA7F42>