From nobody Sun Jun 16 16:20:04 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 4W2JBr6vcGz5P43V; Sun, 16 Jun 2024 16:20:04 +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 4W2JBr6976z4P7M; Sun, 16 Jun 2024 16:20:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718554804; 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=4kdDWYp5S77udd3eb0rCb1SI2L5Zbkj7sBaY8TxAXRU=; b=xnHjp37ULe/NzcjO9zvhRgba0qcA/yyvEvjnio4H2moAYwZzsCbbIG0U4D1T1y9l7c0zND DTHqsy2HCJ8rmCiRIK8Cf5O2MJ3d4WPKltoI38oEWgDpBx+7+kH2TtJouIhqfE9tAMvgva hrpfHbb6yzSvFNAAPfQW9jGt124bikynpjenI4YUlB38EzApnEakVd1WJBmoRCNYA0fwn9 atbl7mBdXMU0NEpXStSydl6TaqP1+VzD8Z9S0aG3yA18sGVv1jsjTXkS9mdFCD2OqcVoH6 D1D8abCa3kL7HFcT1Np67c+yfowWFg91atpwk+iEbEvQMl2zNHXgplc6OdayaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718554804; a=rsa-sha256; cv=none; b=ypdakv+hLFMzI91IgZWn2mXCW6rXi0CySwAf6qKecD2uVv890090GyGao8VJJFwfiG7AAb etO5EKBKFJdgzNSF17e9K9r6u4GOYXZg8R4+mdIAIgJ8L6PRoGsbU88XwXcrCl4SIPbWU2 y2jcEtJXYAoS+mYgODeHoEW3Di+ucgteccJpfzZNcAxpX1hN8TGC33OYuf99FadknZN2Kp mIjjHyXi9o7xymfwzU/JK720KCP2IxwWWlEMrN406OzFFnnNmG4kQqW4S2S8mC7IMB+BT3 MdsLM5OJxu4ejsPOq9mXdQVFujm9x2974M4bUCMsdcs4zhPVt3L/EDXjF624Mw== 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=1718554804; 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=4kdDWYp5S77udd3eb0rCb1SI2L5Zbkj7sBaY8TxAXRU=; b=I5q5WHYUq8OGQyfgW6LxRnczfvRqhJVkXs9g4N7Y6csFaDMOdGJV0/FX+fCrcQQCn7miBr BraDNz8kisFLnlkBESgX3SZrLvl0pFGNJuZ97K4bXAJoogxnaqwiDQj9Zn+LIef2vZFUNp EdIcI7soqsgAUkED1MRgQtABLwHLAolkTXDH7MsJzH+8br5I+SAo15W0qy90rxHobUfyZA AumCYqSRNlbxgvGKbqjPYNWN8WU/H/1AHZP6l/jzlK9Tc5lKHBSmfIHOzHi2Ro/lvbdrvh ooXqMMKwrIWvqSRGGDpvwAh/Yy6IzhaP7aVSSwFvqsLpShwNwgQXKoqFB4gouw== 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 4W2JBr5m42zvHj; Sun, 16 Jun 2024 16:20:04 +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 45GGK41b041113; Sun, 16 Jun 2024 16:20:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45GGK4Dq041106; Sun, 16 Jun 2024 16:20:04 GMT (envelope-from git) Date: Sun, 16 Jun 2024 16:20:04 GMT Message-Id: <202406161620.45GGK4Dq041106@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: b53b21e8f81a - main - amd64 pmap: Release PTP reference on leaf ptpage allocation failure 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b53b21e8f81a8d2d233b99cee6426c2f64765a3c Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=b53b21e8f81a8d2d233b99cee6426c2f64765a3c commit b53b21e8f81a8d2d233b99cee6426c2f64765a3c Author: Bojan Novković AuthorDate: 2024-06-13 15:58:49 +0000 Commit: Bojan Novković CommitDate: 2024-06-16 16:19:26 +0000 amd64 pmap: Release PTP reference on leaf ptpage allocation failure aa3bcaa 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: aa3bcaa Differential Revision: https://reviews.freebsd.org/D45577 --- sys/amd64/amd64/pmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 4d4ecc8ea4e2..dee208fc9145 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7595,10 +7595,13 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, if ((newpde & PG_W) != 0 && pmap != kernel_pmap) { uwptpg = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), VM_ALLOC_WIRED); - if (uwptpg == NULL) + if (uwptpg == NULL) { + pmap_abort_ptp(pmap, va, pdpg); return (KERN_RESOURCE_SHORTAGE); + } if (pmap_insert_pt_page(pmap, uwptpg, true, false)) { pmap_free_pt_page(pmap, uwptpg, false); + pmap_abort_ptp(pmap, va, pdpg); return (KERN_RESOURCE_SHORTAGE); }