From nobody Fri Nov 26 11:31:11 2021 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 E137E18C653A; Fri, 26 Nov 2021 11:31:12 +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 4J0sy80lybz4hSn; Fri, 26 Nov 2021 11:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EE2BD2F84B; Fri, 26 Nov 2021 11:31:11 +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 1AQBVB5h074017; Fri, 26 Nov 2021 11:31:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AQBVBYs074016; Fri, 26 Nov 2021 11:31:11 GMT (envelope-from git) Date: Fri, 26 Nov 2021 11:31:11 GMT Message-Id: <202111261131.1AQBVBYs074016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 090636264654 - main - sctp: add some asserts, no functional changes intended 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0906362646546843f371bebccb51d5578a99cc7c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637926272; 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=YeutvtBc8RcHsSBGJL50cKchw6UXVTZOxIx43JdpVMs=; b=RcfoErTHHF/+JOt6DULd9h0G/5UWq4y+whV0tJUk5Jmkgw7pP9odkWQLWCemVqU5u5oOcW tn6npuoH1SdkqIVdEBspXM2ZrMgwP/HTdkpP/sCgdYWmabvp9/qckEfiyeGlcZPz+7Ih3t I5HJlcdc33rWXcb/SNttvIrA7rk1qUsd3iFKgEKhEbxy/xZm6Fq+J5GBszRXEDwc8m9xeQ 5z+5kv1/nkhdM+ZJYOz6WkbUWsbjqVQjp2ljZAbwKgpsRRe3GBC++fn0qH+poTw9p2RQ/6 LUn7LxFHgFMODBHfk4U90iIZLz+JMTM0GpBbPC9i5ZumDAInR1kPDmnWrFuADw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637926272; a=rsa-sha256; cv=none; b=EBBjDvhBZZRZQNfk8Hr2BaRXkRK9uEjZeaQEDjKDDylSEBUri68PvFPeto6e57xPXvqber VoCLle7Aw53YK3aHUdGJ3Xhb/EHsPF8UdTkq9pe/QUQ9xrbQsxJ5yfCqE1RAL9Q6FsIEtC sMi9tG6jqDM+i7oC0yfnEtI9ClT+N/ZOyDC6HyHohT9/0QGm7Sfty/sygrtOy5b6jYIknm t/HdA+1hTn23D6uHrUylRK+oqjzpLb9KdxVmDVzPymoV7xabMt6VsWK6uoYjepgqCQBHlB qlZzPpSZnmGtfZC1aApU+7lr5oDdJ/RYg6AN+KDItZu9cAKyCbDhP07NgL4hog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0906362646546843f371bebccb51d5578a99cc7c commit 0906362646546843f371bebccb51d5578a99cc7c Author: Michael Tuexen AuthorDate: 2021-11-26 11:19:33 +0000 Commit: Michael Tuexen CommitDate: 2021-11-26 11:19:33 +0000 sctp: add some asserts, no functional changes intended This might help in narrowing down https://syzkaller.appspot.com/bug?id=fbd79abaec55f5aede63937182f4247006ea883b --- sys/netinet/sctputil.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 9283b1288dae..738f68af7799 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1519,7 +1519,7 @@ select_a_new_ep: SCTP_INP_RUNLOCK(it->inp); goto no_stcb; } - while (it->stcb) { + while (it->stcb != NULL) { SCTP_TCB_LOCK(it->stcb); if (it->asoc_state && ((it->stcb->asoc.state & it->asoc_state) != it->asoc_state)) { /* not in the right state... keep looking */ @@ -1566,16 +1566,23 @@ select_a_new_ep: KASSERT(it->inp == it->stcb->sctp_ep, ("%s: stcb %p does not belong to inp %p, but inp %p", __func__, it->stcb, it->inp, it->stcb->sctp_ep)); + SCTP_INP_RLOCK_ASSERT(it->inp); + SCTP_TCB_LOCK_ASSERT(it->stcb); /* run function on this one */ (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); + SCTP_INP_RLOCK_ASSERT(it->inp); + SCTP_TCB_LOCK_ASSERT(it->stcb); /* * we lie here, it really needs to have its own type but * first I must verify that this won't effect things :-0 */ - if (it->no_chunk_output == 0) + if (it->no_chunk_output == 0) { sctp_chunk_output(it->inp, it->stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED); + SCTP_INP_RLOCK_ASSERT(it->inp); + SCTP_TCB_LOCK_ASSERT(it->stcb); + } SCTP_TCB_UNLOCK(it->stcb); next_assoc: