From nobody Fri Jul 05 05:45:10 2024 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 4WFjCW04mfz5QW3s; Fri, 05 Jul 2024 05:45:10 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WFjCV3xVqz4QcL; Fri, 5 Jul 2024 05:45:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720158310; 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=rv/9c80kkbHS6Zx/TjPmmbdZJiJbM2gjsEPpMrxBDjE=; b=UzkKXnI+cFzAZ2R1LSjbHOi+utCUHyLIjrowQl9LFfOH8wqqWanKwAk7nLsOEUWuZ4KcKU IkWSGFW1jfKafzHtfDTFF7/ncze1ACGFFbttYiMhyXBj5SErAHAwgpuqatrqfxyoyTEyFv AzMRymqNfDlg4HfaDZf7KJEEo7Bs0oZgsWA1T5cdf3oAweRclsi2KGzeCT+/OLX6uVj9Q4 rYJbvOgbVHtQiGm5vH8uoDXRJRSayVoFGcgpoM8NbhjWJdtTppibHqneQQjjQjilbeIkPA CqabMj3Vtwa0zgtfI68Qy8ye2xtpXCthms3dup0n1J2fmFMbDZPll20m7O2rHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720158310; a=rsa-sha256; cv=none; b=hAszu0fqWY1FFR7/vQyIytD1PYSwHr8rwiwagW+9HZYZert5nEIPbRMichOQES5RwNj6RF oGlKHFdu2v/zHyq6a04Gvmouehjv4CrXQfP2Trwj2W4I5zwHdhn3j81Ze0ltnS/dauyGCO XBcQ+LDofEEccrJvn30EOmF6G0DtewVccqZHUa5+NffBqYFW2ukWbZOAeh5kY2Fd0+bGt7 2lgWfb/a/m/pCg9BJSpxWlGZf4VOdCnCunti5cJO/m97MkViK83knjwYrkVuniQWA5zqLp F61C28bPQmK43scaOiTW30cWh34DOc/r97iJbMN2/iHQLXqLl+23i1iI7AcO9g== 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=1720158310; 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=rv/9c80kkbHS6Zx/TjPmmbdZJiJbM2gjsEPpMrxBDjE=; b=LKtji60rMSWQZ9GctdV3qgDgC+0BxmiGZz/Chc4itJCrM8Y7/YmZQQWAEQKjoHfjsvNiXF 182Rtw2UTFprkSQ6QJJEpRIi55mhBIeyC8CF+/Kq7hnWbmOphMQMsaJ7Gu6eIK5ATcTkMo K2hPl0T+CuTjNloJdWmVUbj/tNRdPdGjMQaHhPOdguqA9eYUnOThHuLM5nnOmGwP0/i3TV 5AjfK9c5PjyTIyGjsYeFfMYhB63cg+pBszo/ahrnQOsGuQf07C/+eU7c1E//YbK7/7zRmA dzioQ5WXbKOY7hw20RzyfWYR2uzAHOoMpF+F7Z7ydxmPEGG3bYzaemqKGTCjCw== 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 4WFjCV3Y1ZzlNT; Fri, 5 Jul 2024 05:45:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4655jAJF037749; Fri, 5 Jul 2024 05:45:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4655jAM1037746; Fri, 5 Jul 2024 05:45:10 GMT (envelope-from git) Date: Fri, 5 Jul 2024 05:45:10 GMT Message-Id: <202407050545.4655jAM1037746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 383fd3ea0012 - main - arm64: Handle an unaligned start in pmap_mask_set_locked() 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: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 383fd3ea00128cf65fbea0e4cbdb9849945c854b Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=383fd3ea00128cf65fbea0e4cbdb9849945c854b commit 383fd3ea00128cf65fbea0e4cbdb9849945c854b Author: Alan Cox AuthorDate: 2024-07-03 05:15:35 +0000 Commit: Alan Cox CommitDate: 2024-07-05 05:42:52 +0000 arm64: Handle an unaligned start in pmap_mask_set_locked() In pmap_mask_set_locked(), correctly handle a starting address that is in the middle of an L3C page. The symptoms arising from this error included assertion failures in pmap_demote_l3c(). Reported by: andrew Reviewed by: markj Fixes: fd6cb031f577 "arm64 pmap: Add ATTR_CONTIGUOUS support [Part 1]" Differential Revision: https://reviews.freebsd.org/D45851 --- sys/arm64/arm64/pmap.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index f4a46823428a..a9cb8c7fe468 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4403,8 +4403,22 @@ pmap_mask_set_locked(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t m va = va_next; } if ((l3 & ATTR_CONTIGUOUS) != 0) { - l3p += L3C_ENTRIES - 1; - sva += L3C_SIZE - L3_SIZE; + /* + * Does this L3C page extend beyond + * the requested range? Handle the + * possibility that "va_next" is zero. + */ + if ((sva | L3C_OFFSET) > va_next - 1) + break; + + /* + * Skip ahead to the last L3_PAGE + * within this L3C page. + */ + l3p = (pt_entry_t *)((uintptr_t)l3p | + ((L3C_ENTRIES - 1) * + sizeof(pt_entry_t))); + sva |= L3C_SIZE - L3_SIZE; } continue; }