From nobody Sun Sep 20 17:07:36 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 4hnt8T0WhJz6sBBF for ; Sun, 20 Sep 2026 17:07:37 +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 4hnt8S5cr1z4JHT for ; Sun, 20 Sep 2026 17:07:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789924056; 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=liqPxOlwHlmdAXndZOmvSQAt23ZR0Sx5E4Zch3U8P4M=; b=rl8QJznCPw8zO3+DgOh0Q+pnJAesaOzLZa1JAWe6lPZFCU6cpDhQwlKSiDiid4C8ueNl9k 57hOOAaRxM/Pu9wkXIKuF2Nq/3Iro2nwg1BngA0XzQPPsskL4sujga2dynsY6Dw3d7VKdQ uq6HCQD19UH4t07SspQrfm+8JFv2OHtN98oFP9a8pihF8Jc277oPQA1gVmjfU3ANTjixSZ He7hjF0v5vabTQ9W/KrajZEWt69SfXztmm3Cf0xEp2s0Z9RN0bQpLyjuzB7HOPmI47uSc1 IdIvkHAdWymH/EDvLDzVnefZMdKAmn/M9GTKQX1896211nAC+6h1t4apMUQR5g== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789924056; b=muTqtd2yZ2OrS5WMNb13/zDdFZfvSNzQU4YUNGKFJTJHqAw0M8XEJbx0nOBtBHXHN5+ijt bmrGm72dU+F/T17za9866eGiMEmQEzCZUNflMlBVlsAyjjxNpKpD9MfjTAndeVKjsMyFmf Lis4qnDqvfMpFK1RPEUzLLWjX6y4QLwWn5Os8hrpKPPgYQU6zb3nFekuJaqReWKDa5KW6T YnvnDWU6dwze79lD2EauxdmXJfPltut+t9o+P8BRsxPvFbpW7ep1se3QKvIcXMUGqAsdXt YNeVGQyyuClDT3dk+kMJWQE2eYucIYeGlhUBlxKyytq5JAsqDNisoDiiEBf9iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789924056; 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=liqPxOlwHlmdAXndZOmvSQAt23ZR0Sx5E4Zch3U8P4M=; b=lh3JqVUmqCInZsRV/C/vWqsns0N5KPsVkm/zAagaPurjj4msZGCKZ9DHv5qH7LgGTo8sHA irTcTtBnVHMHip9QST3nvWhdKzRCBl0PF60ESPJpUat0L2G6jjHAAWo6OAWkQWdd2iMLXg dczXxSzbCzxh/r1nrMoY4EuuAI0u5j6x+hRNS2mxe3yRop+ZVnjr/DzHLXqDMmRKsSZf5t tQsLxnjVqEHzsijuWsYJPZ9L44e45DGMI2Piku6W+2Uvu0fvgtvRv9b3yl+hHUhnkL4+b6 4WMTikFYorAW32oAHIHEQEpEONqAH5a6YWHhoZ0ktl1uu/8OSVcXXOsKXUdjUg== 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 4hnt8S4b6Dzjxm for ; Sun, 20 Sep 2026 17:07:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30776 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 20 Sep 2026 17:07:36 +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: 0d0f40cd29d2 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 0d0f40cd29d2aba7bfeef8861b73930bbb84308e Auto-Submitted: auto-generated Date: Sun, 20 Sep 2026 17:07:36 +0000 Message-Id: <6ab012d8.30776.2eec2536@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0d0f40cd29d2aba7bfeef8861b73930bbb84308e commit 0d0f40cd29d2aba7bfeef8861b73930bbb84308e Author: Dag-Erling Smørgrav AuthorDate: 2026-09-05 15:44:05 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-09-20 16:51:12 +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 16ab95cf0dc6..87d59c6929b9 100644 --- a/sbin/hastd/nv.c +++ b/sbin/hastd/nv.c @@ -500,7 +500,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); \ } @@ -767,7 +767,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; @@ -776,7 +776,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) {