From nobody Sun Sep 20 17:07:55 2026 X-Original-To: dev-commits-src-branches@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 4hnt8r1fpCz6sBHY for ; Sun, 20 Sep 2026 17:07:56 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hnt8q6jQwz4KZf for ; Sun, 20 Sep 2026 17:07:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789924076; 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=cvtmI6sZccrtOjyVJgzvCQ3Taae87d9he/r8/Ax+0BA=; b=Kw7lSryrW+2QFWz89zCHfmLAi6aQ3XeJ1DlHvzOanyuDb8EuKadJTS2zA7gmlI7Qz2uXlP 6YZ/zcoxXwmyuwMUIUU2oHbbjRJe2VKJ5EtC8IU5oUNrjnqF7pPPnpCulQNHMD0NhNWxHU fmzKmBcyXkUVTycMgnJfTKIgQlbrmCgc1o6wSKKpMR8Wwog+iT/rHT82leYUYhgec17CG0 smWG0OVI+SyPxh0yAcxP3bEZ4fl5/v0IgxzdDW8FJcLJU7nnqc6ORRtz38d2sc7pPCg+nV fUsagWWxfR5sglkPt8lxeyDgMOnUOQPV4Ygb79ubmAEe8YwPxo2qCPV0mjotUw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789924076; b=AUeB3eXDmsvvOlJuGuWXGwQxDHSdRW9DQ/9o/EZL7tuM0puBAM81o4mhbx/CG7/H6jqGWc GTEd8WbiF4MjPw7rGywtc8GU8Bjw7Tgrs3Fwb1mwSEx/GMVhgGAtVV5JjcJvoki6pwYN77 s/nSaidIb7ASV0cqrufQmtIpouQj8Yvdc9K4+lsiF9PsXea/0LLSOTWhC6VElQDFqaUhb6 YHtHW5iFmai/XsIu7J7R1+XroEXSdBCuGlHn9kK9qORUCCdh+veIdVjbIw1PLoYV6Bi0H0 5EjhGjrXdsD6NVApqSaNEQwxcsFwDJKmtqYvTuILJ9na/FFpK2SLxT8BSRmhcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789924076; 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=cvtmI6sZccrtOjyVJgzvCQ3Taae87d9he/r8/Ax+0BA=; b=CK27Asl8VfiLvwF22nvRCxbarjkLjyRGaYG0vVHQEybCySqPP3cDVRUPbrojbvuW8IJbqz 5QJCsBba1MFKp4KCmjTBmE/mBInAdGr8K4zml2E3Ihrm3FV2myVcG8PShsLWfl7J1C4LRD /IvaOxViPQo+ziEhidVyyetHc3NsD3BO9lJSYFHN0hb2qfJtPLCyLcyUR+0Rlw9UlU1oXU xe+m8pAEfcCTwrnPVNo3KDlgaHvpN3NseHoCn1lK4wkAb21FMFkdDlhSv5iybrBqh0E+Ww HaU9p2tLfKDX8R/8ENugDbHQ75cYp52TdUIUfI0uYxzPvjdY5ewLf2Rnz0PYuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hnt8q5jjjzkfj for ; Sun, 20 Sep 2026 17:07:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3191d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 20 Sep 2026 17:07:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: e4b16e786847 - stable/14 - hastd: Ensure nvpair padding is initialized List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e4b16e786847c42f6079ac8f0dea9ca9161ace52 Auto-Submitted: auto-generated Date: Sun, 20 Sep 2026 17:07:55 +0000 Message-Id: <6ab012eb.3191d.6a4c8f29@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e4b16e786847c42f6079ac8f0dea9ca9161ace52 commit e4b16e786847c42f6079ac8f0dea9ca9161ace52 Author: Dag-Erling Smørgrav AuthorDate: 2026-09-05 15:44:05 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-09-20 16:51:17 +0000 hastd: Ensure nvpair padding is initialized The proto-libnv implementation embedded in hastd pads names and values out to the nearest multiple of eight bytes, but leaves the padding uninitialized, leaking up to 14 bytes of recycled heap per pair in a message. While here, switch from bcopy() to memcpy(). MFC after: 3 days Reviewed by: kevans, emaste Differential Revision: https://reviews.freebsd.org/D59343 (cherry picked from commit 911bda7cffbf358c4e83ea05cfe980d429aff61c) --- sbin/hastd/nv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/hastd/nv.c b/sbin/hastd/nv.c index 4e50d0026e7b..e25ad7bbd826 100644 --- a/sbin/hastd/nv.c +++ b/sbin/hastd/nv.c @@ -501,7 +501,7 @@ nv_get_##type(struct nv *nv, const char *namefmt, ...) \ return (0); \ PJDLOG_ASSERT((nvh->nvh_type & NV_ORDER_MASK) == NV_ORDER_HOST);\ PJDLOG_ASSERT(sizeof(value) == nvh->nvh_dsize); \ - bcopy(NVH_DATA(nvh), &value, sizeof(value)); \ + memcpy(&value, NVH_DATA(nvh), sizeof(value)); \ \ return (value); \ } @@ -768,7 +768,7 @@ nv_add(struct nv *nv, const unsigned char *value, size_t vsize, int type, namesize = strlen(name) + 1; - nvh = malloc(sizeof(*nvh) + roundup2(namesize, 8)); + nvh = calloc(1, sizeof(*nvh) + roundup2(namesize, 8)); if (nvh == NULL) { if (nv->nv_error == 0) nv->nv_error = ENOMEM; @@ -777,7 +777,7 @@ nv_add(struct nv *nv, const unsigned char *value, size_t vsize, int type, nvh->nvh_type = NV_ORDER_HOST | type; nvh->nvh_namesize = (uint8_t)namesize; nvh->nvh_dsize = (uint32_t)vsize; - bcopy(name, nvh->nvh_name, namesize); + memcpy(nvh->nvh_name, name, namesize); /* Add header first. */ if (ebuf_add_tail(nv->nv_ebuf, nvh, NVH_HSIZE(nvh)) == -1) {