From nobody Thu Apr 16 15:12:18 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 4fxM1v1ZqSz6Zq3d 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 4fxM1t6TyHz4N1Z 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=1776352338; 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=vkQjRFxrnqe8qIV+NK48nEMsQxnl5jGtiAeQmtjHsUWur0VIT3NIEc8vXDEKhyhnNHUqRa nG60Qb0QgHiNhrNDCiZA8Ud5yzG2ND/AK7JHvF2xJBFZk/e+Um9r0LKIb7491ANo18NDmf KKq9cSajAap4likM5xAWEmrWKm42duhjLMFmvFvEXclsP/2sE8+LkRRRb0C3v/xShN/dJy QgEm5mxkA/k+rbxH6/R8+IYdJ6HFXcj2+T93Hwpsk2NIhKFqCIs+owWOXVszUcOIEpkh65 jcbsgPmo9WiUWOTuC3hYt2CkKtHICif/0EpgrSXB0BwTIhVaf8on6V6bc/draQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776352338; a=rsa-sha256; cv=none; b=u62tNu9jUtgcubfLUMHdOCGQclqx9cKEbeTlLJim2hYJhXz9At35Aoxya8ZxCyzMXaN676 bF/rGTCpCQ/YG98rPjq5GFXoP+F+H6wfBeAiliA7SKRsbSnPD1/dYB3DQZk1YyyOr0S7tZ EBPGJj0e42IaCfrqeTsxq0KnHQstShCBP74NCjLXaLQEujUnlmJ3RjOqjM5ofPHgjJKaL8 CPbS2X4zLzTREgRQRLxBcxXOb69yBU46G1wDuUanHwz8prXYYX3tJXlaqPYpGcou7kSznp Nw2SUaa9ydHA0WSRbmU+1V48c81CLsaoYWlohaMpE5dFRrK4POsldyB7Csc2wQ== 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=1776352338; 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=DHKfp+qDIHxaEjaKyPuhMEzbVdpzLBdSyMT5zcuXmnfgauXtA4DaLPbK4fP/9D1JVhZoDt 2qI6Lzmyrf9UD7NOojloxyMZ4jqcvKO8VXsyyRd+6UnbrvFKqzzT9vKZiYOI29Yzx5HkCm zA0cNg1Msp0jIzv8bC4HF+4KO0xll+A1E+YzbhgQxqBd3H9DWbbam2hFWrhZSqJNsnKJGi uFrlnOV3Vq580XdwuLYuCb2dEV/iVofHU9Fgv2zTMCT1TiWxVzNMjxb0fnbagBfqpgDe5v JN5hlqQcea7podJkMcux5god2vQXEqc158QHRjhlC8GFUY7dHo1CDNxnUBvelA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fxM1t65Hnz1BHx 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: 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 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)