From nobody Mon Aug 08 03:57:35 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 4M1Mq35Qcgz4YnbG; Mon, 8 Aug 2022 03:57:35 +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 4M1Mq342Lkz49wS; Mon, 8 Aug 2022 03:57:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659931055; 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=DOe08xeQNl3BmKDhmP5HacS+q/EWlqpdbyOmVSp4ZWc=; b=oFGboj2ZbOsaltEKzFKo3JVnNB9W5eA0DtP/lCbfyp4eNQQAQhv1dT9AqHnOyaHXjN2cKk /I+GPeBskqMRaM/iuKcf1SlZQOlX6URtiSSM8udp5IhIKwGpDzHcdsZdkb0SPPVkKLSZmf wrH49+5L24ta4AhlAama59AhFeOOH0FWMv1/a1W/mZq7NDxeAeKECOUPuSwNWMMidu0fD+ UPwAkMrRCOOP2ygFoGAp7+thbl68oU7niN0pDwDnk5EuXM61kkAAKe1IT/Kg+2VjCiSpZf YhKNatuQINz+hdKdiUb2XLESWnz81PSGiwiCLKOKGP07mHkTSbW+k16IksaCjA== 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 4M1Mq336q1zd3C; Mon, 8 Aug 2022 03:57:35 +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 2783vZjZ061019; Mon, 8 Aug 2022 03:57:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2783vZVH061018; Mon, 8 Aug 2022 03:57:35 GMT (envelope-from git) Date: Mon, 8 Aug 2022 03:57:35 GMT Message-Id: <202208080357.2783vZVH061018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Doug Moore Subject: git: 14fa36d1c1b6 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 14fa36d1c1b603ae5b61358d6ff8acd858c01f9f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659931055; 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=DOe08xeQNl3BmKDhmP5HacS+q/EWlqpdbyOmVSp4ZWc=; b=wpZ9E4+kSpMrZSOP0ovTejE4LdOFT3RScDl+fERSI6zxRPRXjO9zXAkzUYBo4nLf02O1Kk E4RqcJw3aaTLmnHQp48Aq987WMPEejS2RQkCtt1H0dfn/hs+WWVdCpiMY3W7yMPIFlwzKW Rvs0cmPOBQy97W8/pVZzUaTLOb6mUf19Vrao0yS/OOypUF78jmz+sHOQ2EzsQDYquQBz6U 6yX+LslX7Ieo1fJxen95Zc2NBnwqri/bWY/4AEzIhF9tqtnKfPbPCuifk5NFNMFuAOdMMH DA/t6bC034xTQ+fNhZNCqWNvuRqa6qudu/r8OKj7sg8i+YpZHaU+N4D/5LGMsw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659931055; a=rsa-sha256; cv=none; b=FeyzXZflevQzuO36/b3OBIyrjHko2dE0R/4y7NCVDbunLQ91c0CeTZi8XAy6kdVxAOiVm/ q8geiHGEZzJefWrKTQus0gEB1eKGtBL0Fa+ljpuU0ibDBai8xUH7fc93t6QMvrUDUPUioT CJzk2kzs8ym48woFoMyS8eLblloYHHPmmL0z30+ImlKVKpQ1H5A+0wW6n/FhmvYWrsWEbY hyk2/JxV1/5ucLFurLlKdwi4eWawMsgUabu1onmIGsilOo9VOaJ3QOOBZ+xzPHR4ZDYUe8 sGFVKffY+GnUpQmhe6USAGhYohm5Hs3+ltabI4Umv3CwiQVLzz/JytwHkXZGIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=14fa36d1c1b603ae5b61358d6ff8acd858c01f9f commit 14fa36d1c1b603ae5b61358d6ff8acd858c01f9f Author: Doug Moore AuthorDate: 2022-04-20 22:24:11 +0000 Commit: Doug Moore CommitDate: 2022-08-08 03:39:38 +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 (cherry picked from commit 11fced21ccea1b80327d159a4c27046cb1f46952) --- 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 abc7a336117c..801c75c356cf 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -311,7 +311,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. */