From nobody Sun Jun 16 16:20:10 2024 X-Original-To: dev-commits-src-main@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 4W2JBy3lLxz5P43c; Sun, 16 Jun 2024 16:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W2JBy22zxz4PBh; Sun, 16 Jun 2024 16:20:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718554810; 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=alHLw9Xl7r5Zulusvkd7BBIV3EkJlY2kzU5TB+5WKyQ=; b=WJzv4Gevdnwr6UEUgGM7uRiPScVpMnfcJqFehOj+lsOdmUj+qJfx8zNTbFlX/LMHVb2h+A dWmvT8TZ0TUOBx3JLR6TXzQQpEboxppTjlwZcu4ZZaE4d++upg3Zk101Y8z70z/lItGFYf yVIVlvc7dXek8A0tCtirCjK815bKJMgmqDXWk08r11qU0WupX4XM4FG3O+rSeLh7kxqnRQ 0mqSegT9MGnIqj5BCMENpUgytj6P/gWWvsxJhMwY1qS+WIbqCzx5uzZim0zSMJwcbxpX5F tidRx6v/iJbJa++hrUL6Zv7yoQ8oVTrCydSRnmQUc27GeluD8J3WOO0AH0whOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718554810; a=rsa-sha256; cv=none; b=VB3NF+OhiY7SW4zcLL55Ju7kLXxi5MyzU5nFDfw01NGOlwgO8oGQlpQEOPIIdPsDgLRzf8 IpmUZhdm0fq5VJQ3cgZZD8blOSdW7KM33jNoWFrN8HSsblmXFSSw8y7xnl8G64F5SGyIxz WY+9HfilxxBEaiB/fzl9xo1Ydj3QJyR0++NXS+7cDDz/lVZ99X8JDeRKXcbdUvoQqNJDGU xdxRmNphvmLVn+1ZeFJlNi0te225Ce3OOs8gmqTd1gGbld944683oBpMRX5C+WaDTLWpwY xVHr6PdvsVsZODpD+QSC0UBYZOTVs8GLFE0Ag2Q7EgGri28kxpvWqbAOca3gBg== 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=1718554810; 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=alHLw9Xl7r5Zulusvkd7BBIV3EkJlY2kzU5TB+5WKyQ=; b=yeDwQszowgCEngWr9QRmB458YIiEMqt6LtquS/T1c7P04isoGfu+fwhhUkJGqC7r73+Lai eFPALSGf8M5qlW0t9l+JyjF7odUwhdDXJvrTOPFdkQ71GXZUU17ZoSc23y3N6+uF0cw704 MJvL8G/h8bJjERsK8oMwnpm5HbDpf5yzqXqzBYjavRkCiJEobQSIuOnSXziLlz6wkp0drq h9jyW+aWhLaW81QyZCr4vkoaJASw86bP32CHqfOaNhkFjafsqwryIsuK/QrnKD2/LNfSze JUF5n01NR+iAKKYRJ0CSKCi2bZ4w7wle0im+DC+wIUCBMeyt2cJ/M7sbhdiXDA== 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 4W2JBy1gTRzvcr; Sun, 16 Jun 2024 16:20:10 +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 45GGKA1k042807; Sun, 16 Jun 2024 16:20:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45GGKAnr042801; Sun, 16 Jun 2024 16:20:10 GMT (envelope-from git) Date: Sun, 16 Jun 2024 16:20:10 GMT Message-Id: <202406161620.45GGKAnr042801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 774549fe06ac - main - riscv pmap: Release PTP reference on leaf ptpage allocation failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 774549fe06ac0f45a5a5a661a7fb4107a8695d4c Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=774549fe06ac0f45a5a5a661a7fb4107a8695d4c commit 774549fe06ac0f45a5a5a661a7fb4107a8695d4c Author: Bojan Novković AuthorDate: 2024-06-13 16:14:21 +0000 Commit: Bojan Novković CommitDate: 2024-06-16 16:19:27 +0000 riscv pmap: Release PTP reference on leaf ptpage allocation failure d0941ed fixed an edge case invloving mlock() and superpage creation by creating and inserting a leaf pagetable page for mlock'd superpages. However, the code does not properly release the reference to the pagetable page in the error handling path. This commit fixes the issue by adding calls to 'pmap_abort_ptp' in the error handling path. Reported by: alc Approved by: markj (mentor) Fixes: d0941ed Differential Revision: https://reviews.freebsd.org/D45580 --- sys/riscv/riscv/pmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 4f6305ed651d..1e4061935ca0 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -3291,12 +3291,14 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, if ((new_l2 & PTE_SW_WIRED) != 0 && pmap != kernel_pmap) { uwptpg = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (uwptpg == NULL) { + pmap_abort_ptp(pmap, va, l2pg); return (KERN_RESOURCE_SHORTAGE); } uwptpg->pindex = pmap_l2_pindex(va); if (pmap_insert_pt_page(pmap, uwptpg, true, false)) { vm_page_unwire_noq(uwptpg); vm_page_free(uwptpg); + pmap_abort_ptp(pmap, va, l2pg); return (KERN_RESOURCE_SHORTAGE); } pmap_resident_count_inc(pmap, 1);