Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Aug 2022 12:41:27 -0700
From:      Cy Schubert <Cy.Schubert@cschubert.com>
To:        "Alexander V. Chernikov" <melifaro@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 29029b06a6f7 - main - routing: remove info argument from  add/change_route_nhop().
Message-ID:  <20220802194127.3D45EC4@slippy.cwsent.com>
In-Reply-To: <202208010853.2718rMqh090712@gitrepo.freebsd.org>
References:  <202208010853.2718rMqh090712@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <202208010853.2718rMqh090712@gitrepo.freebsd.org>, "Alexander V. 
Che
rnikov" writes:
> The branch main has been updated by melifaro:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=29029b06a6f7fd51c34c9db88cc98a66
> 53ee5046
>
> commit 29029b06a6f7fd51c34c9db88cc98a6653ee5046
> Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> AuthorDate: 2022-07-28 13:41:11 +0000
> Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> CommitDate: 2022-08-01 07:41:07 +0000
>
>     routing: remove info argument from add/change_route_nhop().
>     
>     Currently, rt_addrinfo(info) serves as a main "transport" moving
>      state between various functions inside the routing subsystem.
>     As all of the fields are filled in directly by the customers, it
>      is problematic to maintain consistency, resulting in repeated checks
>      inside many functions. Additionally, there are multiple ways of
>      specifying the same value (RTAX_IFP vs rti_ifp / rti_ifa) and so on.
>     With the upcoming nhop(9) kpi it is possible to store all of the
>      required state in the nexthops in the consistent fashion, reducing the
>      need to use "info" in the KPI calls.
>     Finally, rt_addrinfo structure format was derived from the rtsock wire
>      format, which is different from other kernel routing users or netlink.
>     
>     This cleanup simplifies upcoming nhop(9) kpi and netlink introduction.
>     
>     Reviewed by:    zlei.huang@gmail.com
>     Differential Revision: https://reviews.freebsd.org/D35972
>     MFC after:      2 weeks

Hi,

Just picking this commit:

One of these routing commits has caused a panic during setup of gif(4) to 
Tunnelbroker.

<118>Created clone interfaces: gif0 bridge0.
<6>lo0: link state changed to UP
<6>sk0: link state changed to DOWN
<6>xl0: link state changed to DOWN
<6>fxp0: link state changed to DOWN
<6>nfe0: link state changed to DOWN
<6>nfe1: link state changed to DOWN


Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 01
fault virtual address   = 0x70
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff80806c66
stack pointer           = 0x28:0xfffffe00c43387b0
frame pointer           = 0x28:0xfffffe00c4338810
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 513 (ifconfig)
trap number             = 12
panic: page fault
cpuid = 1
time = 1659466745
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfffffe00c4338570
vpanic() at vpanic+0x151/frame 0xfffffe00c43385c0
panic() at panic+0x43/frame 0xfffffe00c4338620
trap_fatal() at trap_fatal+0x387/frame 0xfffffe00c4338680
trap_pfault() at trap_pfault+0x4f/frame 0xfffffe00c43386e0
calltrap() at calltrap+0x8/frame 0xfffffe00c43386e0
--- trap 0xc, rip = 0xffffffff80806c66, rsp = 0xfffffe00c43387b0, rbp = 
0xfffffe
00c4338810 ---
nhop_get_nhop() at nhop_get_nhop+0x26/frame 0xfffffe00c4338810
nhop_create_from_info() at nhop_create_from_info+0x20c/frame 
0xfffffe00c4338860
rib_add_route() at rib_add_route+0x1e9/frame 0xfffffe00c43388e0
rib_handle_ifaddr_info() at rib_handle_ifaddr_info+0xd7/frame 
0xfffffe00c4338950
in6_update_ifa() at in6_update_ifa+0xb6d/frame 0xfffffe00c4338ad0
in6_control() at in6_control+0x83c/frame 0xfffffe00c4338bc0
ifioctl() at ifioctl+0x7bc/frame 0xfffffe00c4338cc0
kern_ioctl() at kern_ioctl+0x26d/frame 0xfffffe00c4338d30
sys_ioctl() at sys_ioctl+0x100/frame 0xfffffe00c4338e00
amd64_syscall() at amd64_syscall+0x10c/frame 0xfffffe00c4338f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00c4338f30
--- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x640bee2d97a, rsp = 
0x640bb37
3718, rbp = 0x640bb373760 ---
Uptime: 22s
Dumping 370 out of 5089 MB:..5%..13%..22%..31%..44%..52%..61%..74%..83%..91%

__curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:59
59              __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct 
pcpu
,
(kgdb) #0  __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:5
9
#1  dump_savectx () at /opt/src/git-src/sys/kern/kern_shutdown.c:405
#2  0xffffffff806be738 in dumpsys (di=0x0)
    at /opt/src/git-src/sys/x86/include/dump.h:87
#3  doadump (textdump=1) at /opt/src/git-src/sys/kern/kern_shutdown.c:434
#4  kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:541
#5  0xffffffff806bec1e in vpanic (fmt=<optimized out>,
    ap=ap@entry=0xfffffe00c4338600)
    at /opt/src/git-src/sys/kern/kern_shutdown.c:979
#6  0xffffffff806bea53 in panic (fmt=<unavailable>)
    at /opt/src/git-src/sys/kern/kern_shutdown.c:903
#7  0xffffffff80a34bb7 in trap_fatal (frame=0xfffffe00c43386f0, eva=112)
    at /opt/src/git-src/sys/amd64/amd64/trap.c:942
#8  0xffffffff80a34c0f in trap_pfault (frame=0xfffffe00c43386f0,
    usermode=false, signo=<optimized out>, ucode=<optimized out>)
    at /opt/src/git-src/sys/amd64/amd64/trap.c:761
#9  <signal handler called>
#10 0xffffffff80806c66 in get_aifp (nh=0xfffff8002291a200)
    at /opt/src/git-src/sys/net/route/nhop_ctl.c:138
#11 nhop_get_nhop (nh=nh@entry=0xfffff8002291a200,
    perror=perror@entry=0xfffffe00c4338834)
    at /opt/src/git-src/sys/net/route/nhop_ctl.c:319
#12 0xffffffff8080680c in nhop_create_from_info (
    rnh=rnh@entry=0xfffff80004924400, info=info@entry=0xfffffe00c4338a20,
    nh_ret=nh_ret@entry=0xfffffe00c4338890)
    at /opt/src/git-src/sys/net/route/nhop_ctl.c:299
#13 0xffffffff8080c6a9 in create_rtentry (rnh=0xfffff80004924400,
    info=0xfffffe00c4338a20, prt=<optimized out>)
    at /opt/src/git-src/sys/net/route/route_ctl.c:661
#14 add_route (rnh=0xfffff80004924400, info=0xfffffe00c4338a20,
    rc=0xfffffe00c43388f8) at /opt/src/git-src/sys/net/route/route_ctl.c:713
#15 rib_add_route (fibnum=<optimized out>, info=0xfffffe00c4338a20,
    rc=0xfffffe00c43388f8) at /opt/src/git-src/sys/net/route/route_ctl.c:586
#16 0xffffffff8080d4bf in rib_action (fibnum=579969536, 
action=action@entry=1,
    info=0xfffffe00c4338834, rc=0xfffff8002291a280,
    rc@entry=0xfffffe00c43388f8)
    at /opt/src/git-src/sys/net/route/route_ctl.c:1257
#17 0xffffffff8080f3d7 in rib_handle_ifaddr_one (fibnum=0, cmd=1,
    info=0xfffffe00c4338a20)
    at /opt/src/git-src/sys/net/route/route_ifaddrs.c:81
#18 rib_handle_ifaddr_info (fibnum=579969536, cmd=cmd@entry=1, 
info=0x100004,
    info@entry=0xfffffe00c4338a20)
    at /opt/src/git-src/sys/net/route/route_ifaddrs.c:107
#19 0xffffffff8087001d in in6_handle_dstaddr_rtrequest (cmd=1,
    ia=0xfffff80022887480) at /opt/src/git-src/sys/netinet6/in6.c:1307
#20 in6_notify_ifa (ifp=<optimized out>, ia=<optimized out>,
    ifra=<optimized out>, hostIsNew=<optimized out>)
    at /opt/src/git-src/sys/netinet6/in6.c:1518
#21 in6_update_ifa_internal (ifp=0xfffff80022721800, 
ifra=0xfffff8000799e400,
    ia=0xfffff80022887480, hostIsNew=<optimized out>, flags=<optimized out>)
    at /opt/src/git-src/sys/netinet6/in6.c:1196
#22 in6_update_ifa (ifp=0xfffff80022721800, ifra=0xfffff8000799e400,
    ia=0xfffff80022887480, flags=flags@entry=0)
    at /opt/src/git-src/sys/netinet6/in6.c:899
#23 0xffffffff8086effc in in6_control (so=<optimized out>,
    cmd=<optimized out>, data=<optimized out>, ifp=<optimized out>,
    td=<optimized out>) at /opt/src/git-src/sys/netinet6/in6.c:572
#24 0xffffffff807e465c in ifioctl (so=0xfffff80016ffa000, cmd=2156423451,
    data=<optimized out>, td=0x0) at /opt/src/git-src/sys/net/if.c:3189
#25 0xffffffff807310ad in fo_ioctl (fp=0xfffff8000775cc80,
    com=18446741877978007604, data=0x100004, active_cred=0xfffff8002291a280,
    td=0xfffffe00c44acac0) at /opt/src/git-src/sys/sys/file.h:365
#26 kern_ioctl (td=0x0, td@entry=0xfffffe00c44acac0, fd=<optimized out>,
    com=18446741877978007604, com@entry=2156423451,
    data=0x100004 <error: Cannot access memory at address 0x100004>,
    data@entry=0xfffff8000799e400 "gif0")
    at /opt/src/git-src/sys/kern/sys_generic.c:803
#27 0xffffffff80730d90 in sys_ioctl (td=0xfffffe00c44acac0,
    uap=0xfffffe00c44aceb0) at /opt/src/git-src/sys/kern/sys_generic.c:711
#28 0xffffffff80a354ac in syscallenter (td=0xfffffe00c44acac0)
    at /opt/src/git-src/sys/amd64/amd64/../../kern/subr_syscall.c:189
#29 amd64_syscall (td=0xfffffe00c44acac0, traced=0)
    at /opt/src/git-src/sys/amd64/amd64/trap.c:1187
#30 <signal handler called>
#31 0x00000640bee2d97a in ?? ()
Backtrace stopped: Cannot access memory at address 0x640bb373718
(kgdb)


At the point of panic we see:

(kgdb) l
133		 * the packet back to ourselves, the ifp would be the loopback
134		 * interface. However, we'd rather know the interface associated
135		 * to the destination address (which should probably be one of
136		 * our own addresses).
137		 */
138		if ((nh->nh_ifp->if_flags & IFF_LOOPBACK) &&
139				nh->gw_sa.sa_family == AF_LINK) {
140			aifp = ifnet_byindex(nh->gwl_sa.sdl_index);
141			if (aifp == NULL) {
142				FIB_NH_LOG(LOG_WARNING, nh, "unable to get aifp for %s index %d",
(kgdb) p nh
$1 = (const struct nhop_object *) 0xfffff8002291a200
(kgdb) p nh->nh_ifp
$2 = (struct ifnet *) 0x0


My relevant rc.conf lines are:

if kqcheckyesno use_tunnelbroker; then
        # tunnelbroker
        tunnel_broker="gif0"
        create_args_gif0="tunnel MY_IPv4_ADDR REMOTE_IPv4_ADDR"
        ifconfig_gif0_ipv6="inet6 MY_ASSIGNED_IPv6_TUNNEL_ENDPOINT_ADDR 
prefixlen 128 mtu 1480"
        ipv6_defaultrouter="MY_IPv6_REMOTE_TUNNEL_ENDPOINT_ADDR"
        ipv6_gateway_enable="YES"
        rtsold_enable="YES"             # Set to YES to enable an IPv6 
router
        rtsold_flags="-F -m gif0"       # Flags to an IPv6 router 
solicitation
else
        rtsold_enable="NO"              # Set to YES to enable an IPv6 
router
        tunnel_broker=''
fi



-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e**(i*pi)+1=0





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220802194127.3D45EC4>