From owner-svn-src-head@freebsd.org Mon Feb 17 09:46:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 961382537A0; Mon, 17 Feb 2020 09:46:33 +0000 (UTC) (envelope-from hselasky@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48LfJT3522z4G6h; Mon, 17 Feb 2020 09:46:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E6E54FF4; Mon, 17 Feb 2020 09:46:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01H9kXwF078741; Mon, 17 Feb 2020 09:46:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01H9kWAh078738; Mon, 17 Feb 2020 09:46:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202002170946.01H9kWAh078738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 17 Feb 2020 09:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358013 - in head/sys: net netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: net netinet netinet6 X-SVN-Commit-Revision: 358013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Feb 2020 09:46:33 -0000 Author: hselasky Date: Mon Feb 17 09:46:32 2020 New Revision: 358013 URL: https://svnweb.freebsd.org/changeset/base/358013 Log: Fix kernel panic while trying to read multicast stream. When VIMAGE is enabled make sure the "m_pkthdr.rcvif" pointer is set for all mbufs being input by the IGMP/MLD6 code. Else there will be a NULL-pointer dereference in the netisr code when trying to set the VNET based on the incoming mbuf. Add an assert to catch this when queueing mbufs on a netisr to make debugging of similar cases easier. Found by: Vladislav V. Prodan PR: 244002 Reviewed by: bz@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/net/netisr.c head/sys/netinet/igmp.c head/sys/netinet6/mld6.c Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Mon Feb 17 01:59:55 2020 (r358012) +++ head/sys/net/netisr.c Mon Feb 17 09:46:32 2020 (r358013) @@ -1056,6 +1056,8 @@ netisr_queue_src(u_int proto, uintptr_t source, struct if (m != NULL) { KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); + VNET_ASSERT(m->m_pkthdr.rcvif != NULL, + ("%s:%d rcvif == NULL: m=%p", __func__, __LINE__, m)); error = netisr_queue_internal(proto, m, cpuid); } else error = ENOBUFS; Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Mon Feb 17 01:59:55 2020 (r358012) +++ head/sys/netinet/igmp.c Mon Feb 17 09:46:32 2020 (r358013) @@ -303,6 +303,7 @@ igmp_save_context(struct mbuf *m, struct ifnet *ifp) #ifdef VIMAGE m->m_pkthdr.PH_loc.ptr = ifp->if_vnet; #endif /* VIMAGE */ + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.flowid = ifp->if_index; } Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Mon Feb 17 01:59:55 2020 (r358012) +++ head/sys/netinet6/mld6.c Mon Feb 17 09:46:32 2020 (r358013) @@ -283,6 +283,7 @@ mld_save_context(struct mbuf *m, struct ifnet *ifp) #ifdef VIMAGE m->m_pkthdr.PH_loc.ptr = ifp->if_vnet; #endif /* VIMAGE */ + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.flowid = ifp->if_index; }