Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 May 2019 19:23:56 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348061 - head/sys/netinet
Message-ID:  <201905211923.x4LJNufW079044@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Tue May 21 19:23:56 2019
New Revision: 348061
URL: https://svnweb.freebsd.org/changeset/base/348061

Log:
  Massively blow up the locking-related KASSERTs used to make sure
  that we end up in a consistent locking state at the end of
  udp_output() in order to be able to see what the values are based
  on which we once took a decision (note: some values may have changed).
  
  This helped to debug a syzkaller report.
  
  MFC after:	2 months
  Event:		Waterloo Hackathon 2019

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Tue May 21 19:18:55 2019	(r348060)
+++ head/sys/netinet/udp_usrreq.c	Tue May 21 19:23:56 2019	(r348061)
@@ -1566,12 +1566,22 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
 release:
 	if (unlock_udbinfo == UH_WLOCKED) {
 		KASSERT(unlock_inp == UH_WLOCKED,
-		    ("%s: excl udbinfo lock, shared inp lock", __func__));
+		    ("%s: excl udbinfo lock %#03x, shared inp lock %#03x, "
+		    "sin %p daddr %#010x inp %p laddr %#010x lport %#06x "
+		    "src fam %#04x",
+		    __func__, unlock_udbinfo, unlock_inp, sin,
+		    (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp,
+		    inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family));
 		INP_HASH_WUNLOCK(pcbinfo);
 		INP_WUNLOCK(inp);
 	} else if (unlock_udbinfo == UH_RLOCKED) {
 		KASSERT(unlock_inp == UH_RLOCKED,
-		    ("%s: shared udbinfo lock, excl inp lock", __func__));
+		    ("%s: shared udbinfo lock %#03x, excl inp lock %#03x, "
+		    "sin %p daddr %#010x inp %p laddr %#010x lport %#06x "
+		    "src fam %#04x",
+		    __func__, unlock_udbinfo, unlock_inp, sin,
+		    (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp,
+		    inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family));
 		INP_HASH_RUNLOCK_ET(pcbinfo, et);
 		INP_RUNLOCK(inp);
 	} else if (unlock_inp == UH_WLOCKED)



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