From nobody Thu Jul 23 10:01:19 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 4h5RTr5T03z6lWDD for ; Thu, 23 Jul 2026 10:01:20 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h5RTr0Q1tz3X5Q for ; Thu, 23 Jul 2026 10:01:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784800880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/xtjMS8BanhjmPRNeDiGptZsqAUYrMZ/46liyU3j75A=; b=NSCw0M6GMBmS1X0FqMQvV+nTxMYp1WUwlvgxgl4nq4JI+OFUyTsrJZDY50qfMWk2dVGSJK W9T8TJmMSOAhaUwlLj35k/liWgH4ygRIsibSWPs6lRvDU7WS04+CnimkAn8iWmwMek/s5A Iq/jochkXcfnNH4M0C5fBD6Hsldes1Cs+18sGaGuqD6IXgNlRpgJvucdYmoa1vbMk2JC19 f2+0DehpPZlPu/SQ1vNV+cmpDr+tTfplMSSVDywzPC/0NWVlcbUri+dusavf9pSyxbgNHx s9nqh8KABaS83Uf2w9inz64VH3GjKwWCR4ZVS8x5z+Lw3UEBRwRQN9tn2R6JUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784800880; a=rsa-sha256; cv=none; b=ejlPW2c3JPJpomN0jyMukVHn1hMb94kJFnwkzLUiUKYml/wdtJkwjNztpCbbl96LLWBfwa ON0dmSU4f0Jon7ZOU4e1RQ+rLe4Gs2YZXMucWA33g3VsTyvdf6xmOroBq6gYqjTsuCRMTZ xuB/o7IfWjS+lj/U2iiS3S1Xr5pzhRy8pS0QbGa5dQgjePh0dCdKiMbRGlesf8jAzsdgW1 3ZjBeiFwM41Kqfjmc6dl1zBl3Kf3EW4RoCKm58NO/KNP8CIkeXd6y8vLse9mayGusHMRhI Zq2xgVilWpFfJN+xe7HmZJL2NRkbszDus0XBNvs9uRUWVf77iZhpWSMRjVfH6Q== 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=1784800880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/xtjMS8BanhjmPRNeDiGptZsqAUYrMZ/46liyU3j75A=; b=BVARFBPDSLQuVc41PuBcaq7v17zXIKKSQRvsERMNSp7n5dqe3tnet8wUvVU9SHwrXhrZCe oXhgcs9j8C87wDl2EpsFMDVv7f/Jm15wYjuL54y/PEY0v5mzZ9g3jbJDvvYb5/fkOO9NaI FqnWmpxddW//XXE+9smC/40/PEK1u4F7lFPmpCm0w8eP4qpjwRgBYUg8jUC9r3x4cMRJZK 8HE93cNAkWgnlmdm5KjC2jny7RjSBqfxFTGRBXtdzzwiYgL7rqR55nSAQi4cWWrBxbFAIt FOIZ1MpaDo537pacLYvG9b5U/0Hyohry7WUM1NTgwl/uzwM/pkU4J0sfSk/RUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h5RTq6Dmbz1165 for ; Thu, 23 Jul 2026 10:01:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3be3b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 23 Jul 2026 10:01:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Konstantin Belousov From: Olivier Certner Subject: git: 185d7d4a39f9 - stable/14 - x86/local_apic.c: Properly calculate the number of LVT entries 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 185d7d4a39f9557060003e6377f650d3a553269a Auto-Submitted: auto-generated Date: Thu, 23 Jul 2026 10:01:19 +0000 Message-Id: <6a61e66f.3be3b.16a07b79@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=185d7d4a39f9557060003e6377f650d3a553269a commit 185d7d4a39f9557060003e6377f650d3a553269a Author: Konstantin Belousov AuthorDate: 2026-01-19 11:55:36 +0000 Commit: Olivier Certner CommitDate: 2026-07-23 09:59:17 +0000 x86/local_apic.c: Properly calculate the number of LVT entries First, the CMCI entry index is APIC_LVT_MAX, so it was excluded unconditionall [1]. Second, the number of entries is reported by the version register, and we must not access past the last reported entry. Reported by: olivier [1] Fixes: 11f954b021a1aadde1d03d40ed5d6b529e14da98 Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54773 (cherry picked from commit 709a53c8b20b5770f7e2f117d4799b5617479976) --- sys/x86/include/apicreg.h | 7 ++++++- sys/x86/x86/local_apic.c | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/x86/include/apicreg.h b/sys/x86/include/apicreg.h index 1252647fbab3..4cc9cabdad9e 100644 --- a/sys/x86/include/apicreg.h +++ b/sys/x86/include/apicreg.h @@ -439,7 +439,12 @@ typedef struct IOAPIC ioapic_t; #define APIC_EXTF_SEIO_CAP 0x00000002 #define APIC_EXTF_IER_CAP 0x00000001 -/* LVT table indices */ +/* + * LVT table indices. + * Must be ordered following the appearance of the LVT entries in + * series the LAPIC versions, which is reported by LAPIC_VERSION + * MAXLVT field. + */ #define APIC_LVT_LINT0 0 #define APIC_LVT_LINT1 1 #define APIC_LVT_TIMER 2 diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index ca2411c112a0..675ec7a9c051 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -827,9 +827,12 @@ lapic_early_mask_vec(const struct lvt *l) static void lapic_early_mask_vecs(void) { - int elvt_count, i; + int elvt_count, lvts_count, i; + uint32_t version; - for (i = 0; i < APIC_LVT_MAX; i++) + version = lapic_read32(LAPIC_VERSION); + lvts_count = min(nitems(lvts), lapic_maxlvt(version) + 1); + for (i = 0; i < lvts_count; i++) lapic_early_mask_vec(&lvts[i]); elvt_count = amd_read_elvt_count();