From nobody Mon Oct 16 23:05:13 2023 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 4S8Xkx5zkgz4xv9W; Mon, 16 Oct 2023 23:05:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S8Xkx45Xnz4d6c; Mon, 16 Oct 2023 23:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697497513; 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=Nk7oMvslZfk1PU1Il4P5dkbBwiLrkvjcdHKlhSgL45A=; b=PN53sfxtMQcn4t/qUOemfJav0phJkRcIM/E6xF3u9X8t1riYOYhaJvIsoLCHWwEl5rJUsa BMdlvk0LQUIPGA4oVrYrh81S3T9REXfyipOiGiLxQnMqNNoA6MJL9/dkEw/7gJ3cd2w5ri Ec3HMam9CHIfTQggGpSF3JBkopU0awTgTB47SlvaZ1X4ibPOLgUI1IJawbEv1WTXGk0DHC DLo0Z4KuHS0cbLf+M8GZs4KFhNO5ap0UrldN4JX9J8efkIYGOF45+v/KrKfoJl7Rr2MjCJ 2B33+w+wrE8QAtlWbjAuDARmnqoBlfmcPw0ccN2Xx8LbB+/9aAvWlqQe3tx6XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697497513; a=rsa-sha256; cv=none; b=dv9pEikhUOODiZMlqsIxeztmsIzfJFoElBKCqomnkYXPBRlzZCjeDojn1dku025B5QszOi 5CeS/siXopN/aQjtaEiqplCgsxW1+xvwP8cW8xg7NP+2OPWpMQe0JjKnGNScxiWzh0ui/z mFmaGJfQHnEt1wQrbPN49iBUlTNDRV1ceJ66mcmcMSSTLaKjXqReu1DPL5Pa7+BeZy8n8f vRMMncEVx65bO5+7w2Z+626uV8u/ldmXVjQNRQVAwhveYAGdJlDlYtxKB3+aYU0sPEJ6cP r6N9OQqCeqofKXRSm4lL/4rbV4WwvHUjpd2LI+cxrjsvb+GRTHlCoXlFQamyhw== 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=1697497513; 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=Nk7oMvslZfk1PU1Il4P5dkbBwiLrkvjcdHKlhSgL45A=; b=fLklpHlAMdOUMcb7gQrUi3+PDglnCEJ6p9WaMUFp1I6A434qjJuadW/0Nm0wmoNSaypGnA ab1gWeQRrgtLT3Y4U6NpShfbEq/09wFf1NCicgv6Z0Pd+tSYR3tuhv86zQC4v77pHgiSYu H6BWDaCoQZUGcvRS+LE+vWYKQStiqpnbjSUm9ffg7vzq4GbE7N8emprfpRdXeYWHWxiMfD hsS6usSucXnzEqaMat+ORR/hVTy7bXNNM2Sl1kEj+ayQQwHAPEJD80fiY1EX6TGDUm7fBk r7Xl4yJ1CfWBSM2QKpRSUqKDCxp04LDM0cjs/kfaqlVhOCQXW0hJg4Fs39qCZQ== 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 4S8Xkx2sMQzyx7; Mon, 16 Oct 2023 23:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39GN5DNl046637; Mon, 16 Oct 2023 23:05:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GN5D2B046634; Mon, 16 Oct 2023 23:05:13 GMT (envelope-from git) Date: Mon, 16 Oct 2023 23:05:13 GMT Message-Id: <202310162305.39GN5D2B046634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7ca80c7f4bf7 - releng/14.0 - gic_acpi: Limit the number of CPUs to GIC_MAXCPU 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 7ca80c7f4bf79c7df3d113dd857f7fe41cdeac2f Auto-Submitted: auto-generated The branch releng/14.0 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ca80c7f4bf79c7df3d113dd857f7fe41cdeac2f commit 7ca80c7f4bf79c7df3d113dd857f7fe41cdeac2f Author: John Baldwin AuthorDate: 2023-09-09 19:13:57 +0000 Commit: John Baldwin CommitDate: 2023-10-16 23:04:33 +0000 gic_acpi: Limit the number of CPUs to GIC_MAXCPU madt_table_data contains an array of pointers for each CPU and was allocated on the stack. If MAXCPU is raised to a sufficiently large value this can overflow the kernel stack. Cap the stack growth by using GIC_MAXCPU instead as for other parts of the gicv1/v2 driver in commit a0e20c0ded1a. Suggested by: andrew Reviewed by: andrew, emaste Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D41800 (cherry picked from commit d0af08c4ba3e400049d246d72401ce36d3bee98a) (cherry picked from commit b7f6b86ee7e49718ab8bf74f7a33fa8cda4d38dc) Approved by: re (karels) --- sys/arm/arm/gic_acpi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm/arm/gic_acpi.c b/sys/arm/arm/gic_acpi.c index e18bc12faf4d..56ff78f9b685 100644 --- a/sys/arm/arm/gic_acpi.c +++ b/sys/arm/arm/gic_acpi.c @@ -84,7 +84,7 @@ EARLY_DRIVER_MODULE(gic, acpi, gic_acpi_driver, 0, 0, struct madt_table_data { device_t parent; ACPI_MADT_GENERIC_DISTRIBUTOR *dist; - ACPI_MADT_GENERIC_INTERRUPT *intr[MAXCPU]; + ACPI_MADT_GENERIC_INTERRUPT *intr[GIC_MAXCPU]; }; static void @@ -107,7 +107,7 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) break; case ACPI_MADT_TYPE_GENERIC_INTERRUPT: intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; - if (intr->CpuInterfaceNumber < MAXCPU) + if (intr->CpuInterfaceNumber < GIC_MAXCPU) madt_data->intr[intr->CpuInterfaceNumber] = intr; break; } @@ -151,7 +151,7 @@ gic_acpi_identify(driver_t *driver, device_t parent) } intr = NULL; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i < GIC_MAXCPU; i++) { if (madt_data.intr[i] != NULL) { if (intr == NULL) { intr = madt_data.intr[i];