From nobody Wed Jun 01 07:26:52 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 754851B4BCC5; Wed, 1 Jun 2022 07:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LCggx1s4jz3MLj; Wed, 1 Jun 2022 07:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654068413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hvSxhm4W/RO6DmipwSxmQI3ERFBYcZGsbyD9QpRz6qM=; b=LNm85HUy7tTwu5cVBNX04Kd1lmPVbmvOybEte3FERDT7L1iZChrheUlK8uoLMPehetAmJ1 5J3SWiJNlOeKFtOZHlCAv0cfo7S1eskkv4Sa7QESTixlVxFmLJfN1YjLvC2ALe4L1c/DV4 +Z5uxkdHnwDwyfYQTjtLBXXzht3SCVBQY9idOvLQdl2RoDHI6sitOfG66gqlXIXF2Xg5fe BsvttA2SiiAzy78H4rfza6DXSs8vDRvTEYcW8ITtzo3WbzdZeALQxI2mXhRumJcK9UN3D3 iJ6S8IOQscXjanhBiK272Jo/MH01WN8qVtaT303U+idgYDVs14y+Xu2Ako4PAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BEE31C013; Wed, 1 Jun 2022 07:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2517Qq0R070182; Wed, 1 Jun 2022 07:26:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2517QqGn070181; Wed, 1 Jun 2022 07:26:52 GMT (envelope-from git) Date: Wed, 1 Jun 2022 07:26:52 GMT Message-Id: <202206010726.2517QqGn070181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a7f20faa074d - main - netinet6: fix panic on kldunload pfsync List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7f20faa074d5e9ac0e83f78485fb9cfd3bbf9fd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654068413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hvSxhm4W/RO6DmipwSxmQI3ERFBYcZGsbyD9QpRz6qM=; b=dZqzPiivWNMCy2HWqDs1GLDG3Ui91rhzlrkfO6flzCI9OOMtrRcsePsjYgj++ZXmgIgAOO YERXVVksNLWe4s4/QX3XP7cEUWyT3Jm/0JWfioMmUBjKUFo5LjGE0f0Jg1UJTLPpXYVmLe 7+MUKym4xo16DIdCZv13AuAlFPBVw/uys/BJR0mNceB6PL518/hwtRLV/ZUNYNrj13edWU a9glEE1xKZ8VrhMFe52zBEZJcEQQTK0wZQyefStH20bFfI44M0zcNNWaHSYA4phmUde6O0 Xs4meKX0u9H173LwSEt9XeCTBTlKdDtLGPZ525ib8yINGa0AZDzDX1eEEWkjIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654068413; a=rsa-sha256; cv=none; b=Xp1sOVRD5mDEuVOGlL5De3u72oP2H//yzz1PfVOuqbl48BcYNpIboILdb1e/BwWEreCy3J M8z2cKbngzR947BI92SUOBw5XOEh9INFuZAbS2Ci+9liFOSal8EpYnlY5u9gP1TWBiynEI SmBNsYJaAue+ZNWkdqMR7S+593EcQOq+AkhEEWHi2Fw/F8M++WsRwv93bpl2o3qKDNt4uk gl3uwkRr942Y5EMtBj7DQAA1JdeVFBR1x6zdX0zFuxQUgJ3c/d12KlgFrb5T7LmXtobSLu cIqx3A7JL+pNMScUs4DObp9jxLWT8/lL9kpHsxrisFdVSSKelxHE7gTka+GGSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a7f20faa074d5e9ac0e83f78485fb9cfd3bbf9fd commit a7f20faa074d5e9ac0e83f78485fb9cfd3bbf9fd Author: Kristof Provost AuthorDate: 2022-05-31 19:11:14 +0000 Commit: Kristof Provost CommitDate: 2022-06-01 07:26:15 +0000 netinet6: fix panic on kldunload pfsync Commit d6cd20cc5 ("netinet6: fix ndp proxying") caused us to panic when unloading pfsync: Fatal trap 12: page fault while in kernel mode cpuid = 19; apic id = 38 fault virtual address = 0x20 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff80dfe7f4 stack pointer = 0x28:0xfffffe015d4f8ac0 frame pointer = 0x28:0xfffffe015d4f8ae0 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 = 5477 (kldunload) trap number = 12 panic: page fault cpuid = 19 time = 1654023100 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe015d4f8880 vpanic() at vpanic+0x17f/frame 0xfffffe015d4f88d0 panic() at panic+0x43/frame 0xfffffe015d4f8930 trap_fatal() at trap_fatal+0x387/frame 0xfffffe015d4f8990 trap_pfault() at trap_pfault+0xab/frame 0xfffffe015d4f89f0 calltrap() at calltrap+0x8/frame 0xfffffe015d4f89f0 --- trap 0xc, rip = 0xffffffff80dfe7f4, rsp = 0xfffffe015d4f8ac0, rbp = 0xfffffe015d4f8ae0 --- in6_purge_proxy_ndp() at in6_purge_proxy_ndp+0x14/frame 0xfffffe015d4f8ae0 if_purgeaddrs() at if_purgeaddrs+0x24/frame 0xfffffe015d4f8b90 if_detach_internal() at if_detach_internal+0x1c2/frame 0xfffffe015d4f8bf0 if_detach() at if_detach+0x71/frame 0xfffffe015d4f8c20 pfsync_clone_destroy() at pfsync_clone_destroy+0x1dd/frame 0xfffffe015d4f8c70 if_clone_destroyif() at if_clone_destroyif+0x239/frame 0xfffffe015d4f8cc0 if_clone_detach() at if_clone_detach+0xc8/frame 0xfffffe015d4f8cf0 vnet_pfsync_uninit() at vnet_pfsync_uninit+0xda/frame 0xfffffe015d4f8d10 vnet_deregister_sysuninit() at vnet_deregister_sysuninit+0x85/frame 0xfffffe015d4f8d40 linker_file_sysuninit() at linker_file_sysuninit+0x147/frame 0xfffffe015d4f8d70 linker_file_unload() at linker_file_unload+0x269/frame 0xfffffe015d4f8db0 kern_kldunload() at kern_kldunload+0x18d/frame 0xfffffe015d4f8e00 amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe015d4f8f30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe015d4f8f30 --- syscall (444, FreeBSD ELF64, sys_kldunloadf), rip = 0x1601eab28cba, rsp = 0x1601e9c363f8, rbp = 0x1601e9c36c50 --- This happens because ifp->if_afdata[AF_INET6] is NULL. Check for this, just as we already do in a few other places. See also c139b3c19b52a ("arp/nd: Cope with late calls to iflladdr_event"). Reviewed by: melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35374 --- sys/netinet6/in6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 857e05c0f112..02294b40379b 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2700,6 +2700,9 @@ in6_purge_proxy_ndp(struct ifnet *ifp) struct lltable *llt; bool need_purge; + if (ifp->if_afdata[AF_INET6] == NULL) + return; + llt = LLTABLE6(ifp); IF_AFDATA_WLOCK(ifp); need_purge = ((llt->llt_flags & LLT_ADDEDPROXY) != 0);