From nobody Wed Apr 20 22:27:45 2022 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 E2EAE11D4ACD; Wed, 20 Apr 2022 22:27:45 +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 4KkFfn621sz3k9T; Wed, 20 Apr 2022 22:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650493665; 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=EjxcIEwieJkYFo8eSCHoND7/9f364G6+aKu2CXR7c7U=; b=KQJ1TL/TJ+e5Tk1ca2mRGQTz6uijoLWlNithmBJ3wRUX/yLL4fnF+3wOar17R557WsuXaA cpbBA34k1bjyE2jfXqDlZgVqeVA09qnGDZTNuiDcG6MQ+JG+2eQdW0I/mtWDC1Ebv3RazC ckW2cjXx8xzHM92A3/fC9Wg1UdS9ngq/pU+nal8gfRmAEHx+/F9lSzpQHo3u1hITUPdcmL CEy1uAxj/RyR49nz/wSbxnVV4QecejXMXIyRRa8jbvQ436jEcTKZFZTJpSuQROjwkQa1ep UiBD9+53AgKcMCGyOpjbzztViCSfsTf1ZcG1N29IutOIdLoceMtpv/frxc+JaA== 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 AEF551C23B; Wed, 20 Apr 2022 22:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23KMRj4K060297; Wed, 20 Apr 2022 22:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23KMRj0r060296; Wed, 20 Apr 2022 22:27:45 GMT (envelope-from git) Date: Wed, 20 Apr 2022 22:27:45 GMT Message-Id: <202204202227.23KMRj0r060296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 11fced21ccea - main - dev/iommu: Include offset in maxaddr check. 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11fced21ccea1b80327d159a4c27046cb1f46952 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650493665; 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=EjxcIEwieJkYFo8eSCHoND7/9f364G6+aKu2CXR7c7U=; b=EcPxx74OrkScvdW3HVIo8emroqFLWmM/Zz/eO/Cr3vD7/UhQ1KLOOSg4Iw70of7t9d+uLE mw96mqgeDvoSrNRnMVPQP7Ilif1TDQjb0aXg82e4y0XiJ/IRgFcunjSkmXQCg1Ii7klRkp y9Xn/XSmHdCZQXLSo5GpCImKfgD7YcNS6dFuYnX49jivf5d/JLxNt5dlOmJsSJJhSdQ4RF xF/PXYukpP9fR+lBgdDiQEN8V/ZUdC45yP9Ly87rItidi2UdixE99fX0Mhg8GS8IVGdLHm x7S0ldC9WGqXrh/DqgjqJOXd+685X3WDBpVTvdbIghDeFvi4wNwbNwffodcCsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650493665; a=rsa-sha256; cv=none; b=IFEuO65Cuxr+Pm561I1KORKDO1WDw1yqsSWHo4ozxlZVvH4SBV8okgB4kjIhayZRmixMCE REJbPxNzsz6PtsTeZvAqK278AqKjLQM/QrjHhoFY1+Oq1YxkvzmPEGYT3cs0tfwplOeNMp 5l6Jva9cw2mP3/fVWVfB5N/zKklNZeAmc98eCkqpLUDNexGGjKg7cq983dAjW7d0jm2dat wjkni/+m4rOfdlIdxA7N36HDuLoKSR+EVYJ1R22e8jQ8gHc/7w7lCdGBFRg//KC0EDlGrq z1IzQt8jXQd95OwjUyssQbhLXuaM4XtLpq5KJTrzb6Iq53EjtgQvQfG3biJJuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=11fced21ccea1b80327d159a4c27046cb1f46952 commit 11fced21ccea1b80327d159a4c27046cb1f46952 Author: Doug Moore AuthorDate: 2022-04-20 22:24:11 +0000 Commit: Doug Moore CommitDate: 2022-04-20 22:24:11 +0000 dev/iommu: Include offset in maxaddr check. If iommu_gas_match_one has to adjust for a boundary crossing, its check against maxaddr includes 'offset' in its calculation, to ensure that the allocated memory does not exceed the max address. However, if there's no boundary crossing adjustment, then the maxaddr check disregards 'offset'. Fix that. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D34978 --- sys/dev/iommu/iommu_gas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 043bd0e0f039..c0d4f84a3f1c 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -305,7 +305,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg, a->entry->start = roundup2(beg + IOMMU_PAGE_SIZE, a->common->alignment); - if (a->entry->start + a->size > maxaddr) + if (a->entry->start + a->offset + a->size > maxaddr) return (false); /* IOMMU_PAGE_SIZE to create gap after new entry. */