From nobody Thu Apr 16 15:12:18 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 4fxM1v2SHfz6Zq3h for ; Thu, 16 Apr 2026 15:12:19 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fxM1t6v4Bz4N9H for ; Thu, 16 Apr 2026 15:12:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776352339; 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=DZj/A9Lu242PJAZIderivQkhptGaR8K97tRzlzXn+tU=; b=PPe1fPLL2DoBSgNXACxNsAwzlCf/w13rolWefJs+8R4vmBKN8+twGkrfUIuWR75dkAE9Nd HuSWhUENaZT8g7IcwjOpE/6+Z+5keK84MdRJJW1Z92uB9C4hmIeWZjkI9GwKQtOu7Du6/z ZKjeNCxK5DaPl6oux2EOy844wzOIHLUm9TAHxNgPlJP2G8BqV2pQxI2/pwzlYx1BWvcF8r 5W5oitqrBZE+oKV3NmVoQPdbSg5wHJrEWj2p89v/gTg39LxWsOdIEsSEjELZAsQjGIaM0a 1G+6puj7UJCQv8lQKoGmK70EfZ+NxnqrLOrznaW7m6Er7YaXRBaLF5fK2icqyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776352339; a=rsa-sha256; cv=none; b=FUlrLExQvgpp1QrRN1AHNGvKeBqX6aFKtQlpSTjZMpEcpYif26tKo6G/X87b2a8IE27GgU Hs1Drdez2s0m3TecYkdlJCX/Qjl036F2xC3GCrDMLeDCbaXwHfoRCZc3vt90X8huRtn+e1 w2eNN+Qv0y3H+L4nDmNTokP9NtJljubhZjIHC8EwfO7oM9JDgBNL6+iXnXF7t9IQJaKfD1 5qGp52poSOBaEgOJaSCTs8z6/PKgox3elSoBcQPAlQ6lxsP+vNpJKKqRqe1zWF6jf/83ib vHPyK03xaHf1XImXqtQsGi+ZMDZkwjQXsJU2F7B34qT20J1JL8SjxtpxBB4tyQ== 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=1776352339; 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=DZj/A9Lu242PJAZIderivQkhptGaR8K97tRzlzXn+tU=; b=D3KJpl/q8Sso5JNwt6Jl54nUgCn98cIc2SNVY6KXOHbBlPrut9uA5vWcNBU3v7RKuLd7op au2viscH7gy9PEkHbXyVgRmTsYnzy5VckVLUJ2+uQd7SGj2OyHkHXqw1hamb60RwhGrHT3 2pXFVRGTbvAG169gNAEoYJOPIk+4jGwzhIGSk5ZaLeqHws1SsDh0meBE2dS8IqZ9Z2i7wk ivSaYTNhynm1SlrYMsfN1g7p9pqcZD1KLw99xUvOoDfR/0dIc5yEP3euXaACrhCY3JE8vs AOsiJoC8E9miQUvzPrlHg6XvEQ28f01LpJN6DhHoIBJ/uVUX7Xd6rpbutTzHDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fxM1t65H5z1ByM for ; Thu, 16 Apr 2026 15:12:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e993 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 16 Apr 2026 15:12:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 693ee9fca3bf - stable/14 - io_apic: Don't route to APIC ID > 255 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 693ee9fca3bf915a2b82d3da751bcbeaf489094e Auto-Submitted: auto-generated Date: Thu, 16 Apr 2026 15:12:18 +0000 Message-Id: <69e0fc52.1e993.106bf908@gitrepo.freebsd.org> The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=693ee9fca3bf915a2b82d3da751bcbeaf489094e commit 693ee9fca3bf915a2b82d3da751bcbeaf489094e Author: Colin Percival AuthorDate: 2026-03-14 05:51:04 +0000 Commit: Colin Percival CommitDate: 2026-04-16 15:11:54 +0000 io_apic: Don't route to APIC ID > 255 I/O APIC Redirection Table Entries use 8 bits to encode the Destination ID. Attempting to route an IRQ to a higher APIC ID would result in it being silently routed to the value reduced modulo 256, causing a panic if the IRQ fired since the receiving CPU would not expect that IRQ. Instead, print a warning and mark the interrupt as invalid, resulting in it being forcibly masked. Reviewed by: kib Tested on: EC2 r8i.96xlarge MFC after: 3 weeks Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D55857 (cherry picked from commit 5809c9a77b2d3b83c056ba3ac5ba4e261c0af595) --- sys/x86/x86/io_apic.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index 5dd1bfc3a068..ae104beadf6a 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -364,10 +364,20 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin) /* * Set the destination. Note that with Intel interrupt remapping, * the previously reserved bits 55:48 now have a purpose so ensure - * these are zero. + * these are zero. If the CPU number (in fact, APIC ID) is too + * large, mark the interrupt as invalid, and target CPU #0. */ - low = IOART_DESTPHY; - high = intpin->io_cpu << APIC_ID_SHIFT; + if (intpin->io_cpu <= IOAPIC_MAX_ID) { + low = IOART_DESTPHY; + high = intpin->io_cpu << APIC_ID_SHIFT; + intpin->io_valid = 1; + } else { + printf("%s: unsupported destination APIC ID %u for pin %u\n", + __func__, intpin->io_cpu, intpin->io_intpin); + low = IOART_DESTPHY; + high = 0 << APIC_ID_SHIFT; + intpin->io_valid = 0; + } /* Program the rest of the low word. */ if (intpin->io_edgetrigger)