From nobody Tue Apr 30 13:45:57 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 4VTM0j4gGcz5JGb1; Tue, 30 Apr 2024 13:45:57 +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 4VTM0j2MR9z4cL5; Tue, 30 Apr 2024 13:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714484757; 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=3m3K0I3gOUqyOmHIDThwbae5LvJUObSul2SnvLL7nDU=; b=U87sumUM6q0BDkol4D8KkEyss2IjBItZd1TmDb0HJtMGf0YOQjO04i7nwGIiomk4zEenAr Aaxq8w+g8ePcwC1AfuIpvZ5CycF6qejAMmMsZKiixnA6E/Qj6hQqjD9nng3XCQlNg7WlMp splwUshEqdlehsucM/mcUrSTYc31JAOieQbP4pcxODKpxy66hvqrHnS2Dx6pyY8tjHtLsB u+8WIzGMSB+fHcld2InDfmOuGrnqsk1g1L5A2YFhbD2GBASIVSrAroBCKMyyDvKUWRu7EK +if6oK1m6s7lEdnBNKviIFjZy9WUcz0mxmA/TkoCVQPOah9G35crMoJiDZL65g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714484757; a=rsa-sha256; cv=none; b=asSKnbElG15dgb8SvqlgmpM9s2HqgpAsVRKJK2FUTvKvBE66yBu7XDbyIMCxEt+tdiyyGQ /ck1mHGq9izV+ECWFhy+Z+YBy8f+pdPofAobOyX5Z+5Osx1miZG5phPPtzfUJdks/1l/pJ TTjOLPQ9X4InIlg6mF3uBVWXmhXKEELZkygjy6DlCxjZH9TBtW7EMgZ7hl6p1DN4xpngmC SWco9NelEnzjK7QpLZUIsQjV70ZYHHc6QexN5nK/Glsi+Poq2fga2mILFjKzFUvsShtMlA b5XJHSqD74sIt0fgm+RtmARLvUKH1SA97JCiKEOTgN3eSf7XSGOBWS8Ckf6Xyw== 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=1714484757; 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=3m3K0I3gOUqyOmHIDThwbae5LvJUObSul2SnvLL7nDU=; b=cfgomdAw3iL365xHzqFQ/B8ubCAjS+q/5qRLBcGFv02F2giEewwBzc2bdqxF/1SlciJ1ee ZaLVmQNW+9cvaL3EBsEZWLvgDeab54eoJbYEQVwBQSv2tPPvkal2owMgKbn23si7tTB78H tXm9vtnkwtniJKB4RYwlBlX+gs9wnkSK8AnSYatubydlNQyKDGTHatkBBTp769Bxb2eoII XxgpISE4k4s1ikaWpzivN7vaOqpHY6nxznnXSkWB7MWDYORR/eANZblJbAtHSQBET8ynBl 8vSkPhnMGsjfft3fkVzhy6WrtdAASvbdQdin9goLxrfq2lDM81Oo4vRyMWN5rg== 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 4VTM0j1znbzdDk; Tue, 30 Apr 2024 13:45:57 +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 43UDjvfW033245; Tue, 30 Apr 2024 13:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43UDjvQW033242; Tue, 30 Apr 2024 13:45:57 GMT (envelope-from git) Date: Tue, 30 Apr 2024 13:45:57 GMT Message-Id: <202404301345.43UDjvQW033242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 661a83f9bf9f - main - vm: Fix error handling in vm_thread_stack_back() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 661a83f9bf9f6028c5617d413d59b7f0d9201abd Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=661a83f9bf9f6028c5617d413d59b7f0d9201abd commit 661a83f9bf9f6028c5617d413d59b7f0d9201abd Author: Mark Johnston AuthorDate: 2024-04-29 16:22:36 +0000 Commit: Mark Johnston CommitDate: 2024-04-30 13:45:48 +0000 vm: Fix error handling in vm_thread_stack_back() vm_object_page_remove() wants to busy the page, but that won't work here. (Kernel stack pages are always busy.) Make the error handling path look more like vm_thread_stack_dispose(). Reported by: pho Reviewed by: kib, bnovkov Fixes: 7a79d0669761 ("vm: improve kstack_object pindex calculation to avoid pindex holes") Differential Revision: https://reviews.freebsd.org/D45019 --- sys/vm/vm_glue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index f9235fe03fab..979a0fc27120 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -630,7 +630,11 @@ vm_thread_stack_back(vm_offset_t ks, vm_page_t ma[], int npages, int req_class, return (0); cleanup: - vm_object_page_remove(obj, pindex, pindex + n, 0); + for (int i = 0; i < n; i++) { + m = ma[i]; + (void)vm_page_unwire_noq(m); + vm_page_free(m); + } VM_OBJECT_WUNLOCK(obj); return (ENOMEM);