From nobody Tue Apr 08 13:40:37 2025 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 4ZX6fG0hqcz5sPmf; Tue, 08 Apr 2025 13:40:38 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZX6fF5XPJz3CQh; Tue, 08 Apr 2025 13:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744119637; 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=4s3e8/B3k7Yh5eTts4KSkfCg+flBIvxoghjJwst8dfw=; b=vlG3Ff9RCCD3XOhZkDMZ9ZGa3MeEDrY9hmT5kRSLK3MdGpIQOq/IS5houhkGjMchMI8Zar 6m/10QqfLaB+uzKcPWB1C9t++0VLiBW7HoOU64djT+UlO8t8W437jPk4/BzaLKvbajuUKx xHMcYSqdJki8ea+Rwnm/TuorzNE6fEHqxNEMyNYzZpOUJ6kPq1NcB2EWS2K3n70c/qofiv 4vq3KnkE+Fq5EerB2A5OpA3dEGmr4ONvaW0vu2o8b9lrydPNOIE9+jJEOx9xSC5dCRRF33 W5n+WJhrExPVjldCjoDovaTzUINdJ2dxOIEW6bc/XxFCYysmvuYHvIMfG1ojlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744119637; a=rsa-sha256; cv=none; b=cbF7fepCrfkUsv1XJV7NVGuvOXchpFi+YpJnLxIB4GNczdK/H60zib+DsZ9jdRbLEMiM5h UqFELv81GEgjuAFS1sHF1M9jEBnR5HAEMueQVT3pnA4IgrTb4xGGhgvwB6Pc5qVzBYEd6m a/ex5go3Unc57tWWu7yXCLeqhtQQb5bnbp+/BQNR8Zbmbw09y4YyD0ghmM2k0PDchuKrW5 yzj9rRy3yO9Y4FE16v9gb/irNhCAOQHcOoNLRDJ0un120fRf8nGpqr7GnK6CKRqFPECJyH gT6kafgbaO7Y+hhCZk7lMLSSyyNRSdCP1B8pOEBsehxTw0SC3627IBzqR0BRig== 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=1744119637; 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=4s3e8/B3k7Yh5eTts4KSkfCg+flBIvxoghjJwst8dfw=; b=MnKZIMC2YKt1+HWq97WwjG8SQte4TX+L+V+FVFdWuneNa2k9imlTNKtv7kx3wcT7qXjJRB EGZZ6eVg0/pvIFUPO5csWXc9aZvEcFKwD9WahVX5273NkDbtbDh9rpWRzN35Cy6eB4cFly xSl8Kw/w8ZgUAU4aV27pUiYDtac1CYyN7EwpSmsyJERgbFq3eli1UdFcrmLpMCCf18vM9J VXTXDs3oOb5awtCWm3Gew9pOn9KzSrReeuI4l+m4dASFLJLKCe1wpvJ7RZX9rgzWlH6h57 KWb5zVn4cMrCvW20SQr54Tag1tw3Vmd/LJaJWr6TD6SdMj7hXASII4eJwoTMEw== 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 4ZX6fF4vNgzZwx; Tue, 08 Apr 2025 13:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 538DebNS030586; Tue, 8 Apr 2025 13:40:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 538DebKd030583; Tue, 8 Apr 2025 13:40:37 GMT (envelope-from git) Date: Tue, 8 Apr 2025 13:40:37 GMT Message-Id: <202504081340.538DebKd030583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 9dc47f536d3f - stable/14 - vm_phys_avail_check(): Check index parity, fix panic messages 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9dc47f536d3fd43ca4dd6981443753c55acb8f3f Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9dc47f536d3fd43ca4dd6981443753c55acb8f3f commit 9dc47f536d3fd43ca4dd6981443753c55acb8f3f Author: Olivier Certner AuthorDate: 2024-11-05 08:58:26 +0000 Commit: Olivier Certner CommitDate: 2025-04-08 13:38:20 +0000 vm_phys_avail_check(): Check index parity, fix panic messages The passed index must be the start of a chunk in phys_avail[], so must be even. Test for that and print a separate panic message. While here, fix panic messages: In one, the wrong chunk boundary was printed, and in another, the desired but not the actual condition was printed, possibly leading to confusion. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48626 (cherry picked from commit 125ef4e041fed40fed2d00b0ddd90fa0eb7b6ac3) --- sys/vm/vm_phys.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index cd75ed092691..83038b2af0ea 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -1597,15 +1597,17 @@ vm_phys_avail_count(void) static void vm_phys_avail_check(int i) { + if (i % 2 != 0) + panic("Chunk start index %d is not even.", i); if (phys_avail[i] & PAGE_MASK) panic("Unaligned phys_avail[%d]: %#jx", i, (intmax_t)phys_avail[i]); - if (phys_avail[i+1] & PAGE_MASK) + if (phys_avail[i + 1] & PAGE_MASK) panic("Unaligned phys_avail[%d + 1]: %#jx", i, - (intmax_t)phys_avail[i]); + (intmax_t)phys_avail[i + 1]); if (phys_avail[i + 1] < phys_avail[i]) - panic("phys_avail[%d] start %#jx < end %#jx", i, - (intmax_t)phys_avail[i], (intmax_t)phys_avail[i+1]); + panic("phys_avail[%d]: start %#jx > end %#jx", i, + (intmax_t)phys_avail[i], (intmax_t)phys_avail[i + 1]); } /*