From nobody Fri Sep 04 12:47:37 2026 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 4hbx7z1sk3z6qdnF for ; Fri, 04 Sep 2026 12:47:43 +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 4hbx7y5QSwz4Q3S for ; Fri, 04 Sep 2026 12:47:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788526062; 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=qHaCu9YbsEY4BXHM0cL6e0xbXwt42Up9eAeBhu9lOmo=; b=qG2LIzZzhAXP74XM3S7EQLh9KqSKos7958AJ7FRMSv4RrIDXD38n2/6UfKp3i/MauO851M xNTTd7kFk2KwMDN1gUoTn3WuThmQ4PdudoI/YdVqxb+YLnQ39chGPTi7gax0DKsXEMVT/R nVC2EkGd9nvrjrf5AsJa6BLMFdClGJhfL/w2qjLFPrm3RCc8qHPREsUk2UeqDW1e+OGLVx XwGp+3+5v8n0qERGdYgsgRd8STsn1fAqzgt2AXRYAr8Xxt8W52OF3p7r8YXQmt/+345yYD DaMcVuElZC8q0Sj3sJzNlagdkwxj2s/IfdhffRa1Dx3Gg6QZOfcAuIA7EYxZ7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788526062; a=rsa-sha256; cv=none; b=k9Bvc/3hzcy0n5I6dZg8nUsvMl28fpIoze6xMIfGbcQ2UAwmwY/4YPu5JOg552TyUzflXL bGubFvMpV+WlvHpY4kz8O5rCdK8MdFqID7XE/Y5Xpvi5AnMCFC3JrftpRzgAX8xxPrE901 h0rzjdxQCXWYevvEZPeH0E97gMieKPVf1OzsrHyq2IqZlcTn5Y649MuGiP3ZJQTjBOgEYj tqyG0aeHhSullagQ55U/0FPRNde0/gRPV+zUE5htKG7OYdhnYsvr7/l2EPpeluSqQhqmBp slZofkCX6Db7eEUOEOw0YcwdVZR+0Si4Ab8VKgN3ydT1QUKNhdNQvXukKFmedA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788526062; 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=qHaCu9YbsEY4BXHM0cL6e0xbXwt42Up9eAeBhu9lOmo=; b=dqiqp14N5qD5IE+6fsZxjor0wmTHm+bmzrpTjg0Iq6NmTwReSOoEb+bunO+bPnJTmPqbCY XvfUyq2iRLdScLZyhYX+dzhHjOIULPv97O9z/r6UZIL+VpvvHcSY1R0AKInbjqQ/Lr7jBm XzdrcfypfuOu0FUeyyL2MOwZosLqDsz8CXeU5Xbp6yVjrUERA1RgVQnrF9qVERD8JIiduw jFzSX2H2XTz1VAKODPAWFfBbsoJSRPFfiFeccVDAyTtUf3H9B9BDdHKYWLrqPfm3wW/fhR lAN7aivVd4qxMwwsTSlbisC0wBHqSn/YKcFN7zS4Jf/KtzpplJ0XJqUzQeraKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hbx7y2pw3z1124 for ; Fri, 04 Sep 2026 12:47:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23808 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 04 Sep 2026 12:47:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e1d903bbfaf9 - main - buf: Avoid calling bufdomain() on newly initialized bufs 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1d903bbfaf91060c43209b35b78a9992fbffe5e Auto-Submitted: auto-generated Date: Fri, 04 Sep 2026 12:47:37 +0000 Message-Id: <6a9abde9.23808.6b2b1c5e@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e1d903bbfaf91060c43209b35b78a9992fbffe5e commit e1d903bbfaf91060c43209b35b78a9992fbffe5e Author: Mark Johnston AuthorDate: 2026-09-04 12:46:29 +0000 Commit: Mark Johnston CommitDate: 2026-09-04 12:46:44 +0000 buf: Avoid calling bufdomain() on newly initialized bufs bufinit() inserts newly initialized bufs into the QUEUE_EMPTY queue, at which point they haven't yet been assigned a domain. Thus, bufdomain() returns &bdomain[-1], which trips the array-bounds sanitizer. This is harmless since we don't use the result in that case, but let's avoid the invalid access to begin with. This is sufficient to let an amd64 kernel boot to a login prompt with -fsanitize=array-bounds configured. Reported by: Andrew Griffiths Reviewed by: rlibby, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59381 --- sys/kern/vfs_bio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index cb45ca7c75b7..868d7de7d6c8 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2032,16 +2032,13 @@ bd_flushall(struct bufdomain *bd) static void bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock) { - struct bufdomain *bd; - if (bp->b_qindex != QUEUE_NONE) panic("bq_insert: free buffer %p onto another queue?", bp); - bd = bufdomain(bp); if (bp->b_flags & B_AGE) { /* Place this buf directly on the real queue. */ if (bq->bq_index == QUEUE_CLEAN) - bq = bd->bd_cleanq; + bq = bufdomain(bp)->bd_cleanq; BQ_LOCK(bq); TAILQ_INSERT_HEAD(&bq->bq_queue, bp, b_freelist); } else { @@ -2054,12 +2051,15 @@ bq_insert(struct bufqueue *bq, struct buf *bp, bool unlock) bp->b_subqueue = bq->bq_subqueue; if (bp->b_qindex == QUEUE_CLEAN) { + struct bufdomain *bd; + /* * Flush the per-cpu queue and notify any waiters. * * Unlock before we notify so that we don't wakeup a waiter * that fails a trylock on the buf and sleeps again. */ + bd = bufdomain(bp); if (bd->bd_wanted || (bq != bd->bd_cleanq && bq->bq_len >= bd->bd_lim)) { if (unlock) {