From nobody Fri Dec 17 17:00:00 2021 X-Original-To: dev-commits-src-all@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 6275218E2687; Fri, 17 Dec 2021 17:00:01 +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 4JFwFs0lgpz4Z5T; Fri, 17 Dec 2021 17:00:01 +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 DA0051F985; Fri, 17 Dec 2021 17:00:00 +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 1BHH00Lm002906; Fri, 17 Dec 2021 17:00:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BHH00wc002881; Fri, 17 Dec 2021 17:00:00 GMT (envelope-from git) Date: Fri, 17 Dec 2021 17:00:00 GMT Message-Id: <202112171700.1BHH00wc002881@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: 9f5432d5e5f0 - main - netinet6: ip6_setpktopt() requires NET_EPOCH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 9f5432d5e5f0ef9e034ad3da9fe6b1cf876ae68f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639760401; 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=R5Xf1aKhmW4ZJZ2Jc0iE9cEdRD8LGIba/DHAOk7rPQM=; b=lUHq4tGTEr226HVQGwLRBZ3ELv95+sE/ncS8khvgMXsxUpYmTRuPm3Gb05je42WD+u/1dF 8anGOIrE/ELuHY66JYJxDrU+t8Ml5aFdMacRAw3Gc571FBH3F4/Aw5rdktxCMsBoWFdLYS EU60xRXebhWbyyIKattdP0yfn70yPQa4+zO0HY2k0UyoWqjnpI17dr5ikjLhAJgwM788ZA NRPEh16M1asB/+PjQKCRrrPB2z/6vVqqXrPKkcR/xl/emaoQFv/kdV3djA5jAy/AYzmXFS xuna8RQtld1I12zkcGi1erRHlEeX2PgPuxAkrT7DUhLTVNONcutkymHmrEaoZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639760401; a=rsa-sha256; cv=none; b=jPZzhl7nfTArpNTWitv5+mdGtbLyvKrVDblMeuSjCM9Lg0cGmc/HK1GWXC1ZibNhgMtaWj fTNTvDqQ1z8dXm3XDNCcgP84gHvXH9rhMOj3lY9Q0wmyjFCF5SG6yoDa4nKzP9TsgvQ2qR jgVzSwWSLfXGrcPqch5CEW3mEwxkIXZRKQPpIV67uaDf3gvAgULHyNskwgOA2RvAIQsQnd 8GWK8qjIes5BxrQ2KL8paVWpB1kVd3boDSZUgrIEfuS2jvPr5xK5lPh1244MAS6bTK9Eoz ecrS5ybv3updv0fdkQ2POVVkcRknumoa68OEo1VdOFbC/kPFOIMf5NdTMZ1Zdg== 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=9f5432d5e5f0ef9e034ad3da9fe6b1cf876ae68f commit 9f5432d5e5f0ef9e034ad3da9fe6b1cf876ae68f Author: Kristof Provost AuthorDate: 2021-12-15 13:53:41 +0000 Commit: Kristof Provost CommitDate: 2021-12-17 16:30:36 +0000 netinet6: ip6_setpktopt() requires NET_EPOCH ip6_setpktopt() can call ifnet_byindex() which requires epoch. Mark the function as requiring NET_EPOCH, and ensure we enter it priot to calling it. Reported-by: syzbot+92526116441688fea8a3@syzkaller.appspotmail.com Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33462 --- sys/netinet6/ip6_output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 7d8793b691b4..848ec6694398 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -2546,7 +2546,9 @@ static int ip6_pcbopt(int optname, u_char *buf, int len, struct ip6_pktopts **pktopt, struct ucred *cred, int uproto) { + struct epoch_tracker et; struct ip6_pktopts *opt; + int ret; if (*pktopt == NULL) { *pktopt = malloc(sizeof(struct ip6_pktopts), M_IP6OPT, @@ -2557,7 +2559,11 @@ ip6_pcbopt(int optname, u_char *buf, int len, struct ip6_pktopts **pktopt, } opt = *pktopt; - return (ip6_setpktopt(optname, buf, len, opt, cred, 1, 0, uproto)); + NET_EPOCH_ENTER(et); + ret = ip6_setpktopt(optname, buf, len, opt, cred, 1, 0, uproto); + NET_EPOCH_EXIT(et); + + return (ret); } #define GET_PKTOPT_VAR(field, lenexpr) do { \ @@ -2886,6 +2892,8 @@ ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt, int minmtupolicy, preftemp; int error; + NET_EPOCH_ASSERT(); + if (!sticky && !cmsg) { #ifdef DIAGNOSTIC printf("ip6_setpktopt: impossible case\n");