From nobody Wed Apr 03 16:19:50 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 4V8qhk3vCMz5FLSY; Wed, 3 Apr 2024 16:19:50 +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 4V8qhk3QhDz4pxQ; Wed, 3 Apr 2024 16:19:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712161190; 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=5cuU7D2+NFko/x+uM29aTR/jhIQ5ad5ZEQHKjNb+EqM=; b=nWCXsms77LV9vlj9ZXk9FPb+5OoJImmxD8thEbj9ZUv4/K5M/SXlvQYfoW2ntSHM+jpCZE ZRQz7jILimC48pK1ebCyMvh9Ix+CbS7L4kwDb0kiqLEIUnwFQ7t/61A5s6SMtkBDzrofJc WVWfGDr02p6qDhtwo70pZJKEYlwyMvnFDSPlVNJc5e+CIblWI6vAZPvPn9Vw7WZYtPAlUR 0EfFYBhfbYoFaEEaj3nR7mhPKhSa4OojlYsbLfWYWHBqZh7Vam7BNTcljWiTd8OLG1HGl8 5+zif6ttU5YHVoIW4DieLckCk/mZ4FY0b64x8Hty8dRPk7F7ST3qu7vKADYAIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712161190; a=rsa-sha256; cv=none; b=Ud35lQvpzRrt292RP+KROK6GTXPYmTU/N627t/I1YSqzCFxVqVUja2/zGCIx757d0ZpnFL jIwlzF+mZlAFvOAuku7KgPF7DUjQnY5NEvWrQfNW4dUvkrTH2uWi3NnNDgn0b6eBnatqcw 5xzTlQ7gJ1bJQIX446UdGfCwJro6OuKk0xOkdtCNlLY/POq2Axpk4zSPMIgAyScrVpqYUM Tnd/ctHLrn0hqejAMi4cY0rQ+/qykKZb5500sZxNZ+ixdxWoJmG+Y5Wc8ivkI8i55W5ByU tlNnUVy5/DOdl+OTDZeac+I4Lw8s77qMH8fmX75G405H1ZfYtPoF1jD6lcIx0A== 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=1712161190; 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=5cuU7D2+NFko/x+uM29aTR/jhIQ5ad5ZEQHKjNb+EqM=; b=CKTMkux5B/EXMVPQp88a/D0gs4viiiTkwindY6y20ATcPy3pNS2ngMqyBv9QgRAUg1QmgV ucBtYbE9KE6N7wFmnhYToaKYYegUmTVzdrT9GD2SKKdVvYJw0xIVo5FCQLPm/KoSygeBGB ZV16F+pgpL8y0qtvR+vlnDYf99LQKN46re9Ijat1AQ+0wwhJ0JK5LrQSKSmMH5OBq7ZzCW W+FXaQG3595u4QYzuplhcOw06MLHnXm237U4dRRY7FYHLCa8bzx62NnRSxWiIJEhiAIdzO jHirvZv8lhmNsoGXsmEA8W/s0eyqZnynih6KaizweJ7NDwrPayfOkRYg2cXroA== 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 4V8qhk32rZzg7Y; Wed, 3 Apr 2024 16:19:50 +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 433GJog6096929; Wed, 3 Apr 2024 16:19:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 433GJoF9096926; Wed, 3 Apr 2024 16:19:50 GMT (envelope-from git) Date: Wed, 3 Apr 2024 16:19:50 GMT Message-Id: <202404031619.433GJoF9096926@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: 22c098843127 - main - arm64: correctly handle a failed BTI check in pmap_enter_l2() 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: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22c098843127f6a31e25e94b07b35677f038f6d6 Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=22c098843127f6a31e25e94b07b35677f038f6d6 commit 22c098843127f6a31e25e94b07b35677f038f6d6 Author: Alan Cox AuthorDate: 2024-04-03 05:21:08 +0000 Commit: Alan Cox CommitDate: 2024-04-03 16:19:30 +0000 arm64: correctly handle a failed BTI check in pmap_enter_l2() If pmap_enter_l2() does not create a mapping because the BTI check fails, then we should release the reference on the page table page acquired from pmap_alloc_l2(). Otherwise, the page table page will never be reclaimed. --- sys/arm64/arm64/pmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 12e5e1d73b38..258aa141653b 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5269,8 +5269,11 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, * and let vm_fault() cope. Check after l2 allocation, since * it could sleep. */ - if (!pmap_bti_same(pmap, va, va + L2_SIZE)) + if (!pmap_bti_same(pmap, va, va + L2_SIZE)) { + KASSERT(l2pg != NULL, ("pmap_enter_l2: missing L2 PTP")); + pmap_abort_ptp(pmap, va, l2pg); return (KERN_PROTECTION_FAILURE); + } /* * If there are existing mappings, either abort or remove them.