From nobody Tue Jan 30 05:39:26 2024 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 4TPDWL6Fpsz58LDM; Tue, 30 Jan 2024 05:39:26 +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 4TPDWL5WMwz4Wfp; Tue, 30 Jan 2024 05:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706593166; 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=bsWfeUsNgViJs81flVvf2ljPLcmW+v9XoqSPnqk7Vvg=; b=o3qBpbAnWAUlTkWUEJZW5C9I8nlYIZYdHw0btaAadiFyyX2gvDFKxxfRhHF4jca/UoQfgo NB/MkPgWUgZY5PgFr4JqCjlHMyu0Vbp+fQV0qs6Ovh+S8SYAWxyarSkdUUy7SxKWcIph7s e8FZ1OwtmBQekJaYDnTR76ziAkSqJwrbQ5bEk6pqRiGcEiV31MHe74DhDZOZnoonSicr0d 36SRC9tAnXPSEJxXglLehu6hNroI9Hn23HCdYuSUGlXsODe0SFi4SIvoZlrfpEuxhUB80a XeiI03OMvY/lpcHrVJW5ma6TFApcArjqvuoerXwA/OZ4jkPj19SzhxGhR1sG1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706593166; 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=bsWfeUsNgViJs81flVvf2ljPLcmW+v9XoqSPnqk7Vvg=; b=uleuGrgrJdK9kBvG4Q2VNFNTJZI1YbeSoYcSNxA4bHHWMCcDH3telopK1C4OL78yRLOFc2 5WbijMGN08B1bnXd28tCtYNuDfK009+dQMnrmFlcFRXhoPI7JRLxQSZ6z3tCyEKwApHHht 1cbZ/103F7o6P2xy4FuxkFrVT7Pp8p/rHQ3xk8uSBZ+drLq9T2aoHybMsj+KZCoJv1P0dS zpy6ARoTk+KZPKuk00Re4kq3Y4prWV+z80H99jqW4YFbn89szUmZNY29/VP+5PFyvYdD91 0MZLb/XS3jOYtshuSMIBJ/mnOCX+0P+oT9uhsBVY9yCAJTMQPwVi0HI3+CBL5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706593166; a=rsa-sha256; cv=none; b=yLVRddVOyre1XwpQIROPLSNxcbkghx0w10uUhRAoVsDwfj1zncn2LQ3Hce1Tq81mq9PcF0 9biE3+vWe/XGDUSkQER1VB7S085Q0rsNpxcQ5lPn6nyi7dNPGYnaWgkdDlxH1IycH4O8W/ +EU0e6CquUyDrVKkLM5otKqJfbQaEt3EkbRGRlrEyVIjHTYIlldJehQXevFOvG6R3S+X8w un1imSTdz8q1qwqcjF5XScSSmbNzf2EDbxJoET8wZu2zlJeyfUKrcBARntWrRXIYBvB9rs jyh42+IM3dLP9JQrTG3SWVt/NNKDgzk6W7T+Q72PbKw12w2+/Dxf/li0C49t3g== 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 4TPDWL2SWXzNYJ; Tue, 30 Jan 2024 05:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40U5dQXW019339; Tue, 30 Jan 2024 05:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40U5dQHH019336; Tue, 30 Jan 2024 05:39:26 GMT (envelope-from git) Date: Tue, 30 Jan 2024 05:39:26 GMT Message-Id: <202401300539.40U5dQHH019336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b0fa37f356fd - stable/14 - if_wg: fix access to noise_local->l_has_identity and l_private 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b0fa37f356fd9dd5040c034c7523ec235fbb311b Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b0fa37f356fd9dd5040c034c7523ec235fbb311b commit b0fa37f356fd9dd5040c034c7523ec235fbb311b Author: Aaron LI AuthorDate: 2024-01-17 23:29:23 +0000 Commit: Kyle Evans CommitDate: 2024-01-30 05:37:33 +0000 if_wg: fix access to noise_local->l_has_identity and l_private These members are protected by the identity lock, so rlock it in noise_remote_alloc() and then assert that we have it held to some extent in noise_precompute_ss(). PR: 276392 (cherry picked from commit 7a4d1d1df0b2e369adcb32aea9ef8c180f885751) --- sys/dev/wg/wg_noise.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/wg/wg_noise.c b/sys/dev/wg/wg_noise.c index 3db74ac9580f..a727a2f99d15 100644 --- a/sys/dev/wg/wg_noise.c +++ b/sys/dev/wg/wg_noise.c @@ -281,6 +281,7 @@ noise_local_keys(struct noise_local *l, uint8_t public[NOISE_PUBLIC_KEY_LEN], static void noise_precompute_ss(struct noise_local *l, struct noise_remote *r) { + rw_assert(&l->l_identity_lock, RA_LOCKED); rw_wlock(&r->r_handshake_lock); if (!l->l_has_identity || !curve25519(r->r_ss, l->l_private, r->r_public)) @@ -302,7 +303,10 @@ noise_remote_alloc(struct noise_local *l, void *arg, r->r_handshake_state = HANDSHAKE_DEAD; r->r_last_sent = TIMER_RESET; r->r_last_init_recv = TIMER_RESET; + + rw_rlock(&l->l_identity_lock); noise_precompute_ss(l, r); + rw_runlock(&l->l_identity_lock); refcount_init(&r->r_refcnt, 1); r->r_local = noise_local_ref(l);