From nobody Fri Aug 25 01:08:31 2023 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 4RX1zh13PBz4qb7V; Fri, 25 Aug 2023 01:08:32 +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 4RX1zg52Vvz4Sjk; Fri, 25 Aug 2023 01:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692925711; 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=ph+Davdv4eSkG986gg2uYVZMwKrfIhj6xY6HA9EME7E=; b=lLuHJ9pMpVnbyoYtOwijSyqfbQshY523BNmrySvDduK8vFAnq2kVz6N+FEzU5r0J/kMjHS brdu3vUNvBBGzPg1gvjY2TlRnsgJ5IPOq3h7BkhoKi0RphX4g+1GViX47R2tVvou24mtYS esAwfPQK/wUmkP/tGQMpvf3XnmRwXl+DMrjZp3Mmy/Q9l68iRxom4Wk2evFMZAZ+bERltF 4GrmHLOg/BSExH5uOHpU5kstNqo6yFwctPJm2Wp4Gfsc2mNwVCzXJbs2HxrKIUuO9sBRiG Rdt7Aydf8xwg+XRw7Q+wBfH8BS5m7h0VlWFGFSaNnZDZ1rD/lyDbB9tT9oxn9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692925711; 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=ph+Davdv4eSkG986gg2uYVZMwKrfIhj6xY6HA9EME7E=; b=EZCMATVjFDf8hvaAyla0o1SEgN1EAafvNpQLOk+kVVCX+EhvbexRZPnomlfJgHr4AWudbS cKWWmH7vTaE7DC/B+2kty/q0Cu/5+1FF1+FTlnBdhPT3JF1fj4FApEFXSJ2t4gQ5f2EYlm wJS0irk8XO+Zl7NZKPnmj7u06BqZZKNDO7jzIYvMy1DEBct4RKVKQgef97OEMiuWb07A/A AHIkrgYYSxnonCtS0mJI4Sd3HgZtKui1+kp9Y6TiOn4uHHbcXSMDxkrt9N0Q3nWGXKXyW8 f/z5FTdA8tFTOJbA1O/Z41ErchAW1w93d0ZcavHacPvsP99hhmkIwKyL+2gklA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692925711; a=rsa-sha256; cv=none; b=MjVRe0VLzAn8q3OpqQ/ZoZu57Tv7ngeTZC8YLTCGLD5U7ClctLq3TmvdBBffMqmpF8IJMs oq2QiIE4ae2T3jrEKaT4ToZ/y+kasTU1o06YTdWjBfGOc2QOfjWXjcZBBOrxBpdS/EJs3l s/odnLXKzXbJxOj8rD9EEB4nwEFx6DVmk7RkmwltrVm6huyTVTT73F/dHbILjd4ZdCRiv5 ex6VLDka98jNhflBPyZX9E7HW7j/SxRF95M9Pw/wdupGK+3gNSZ7qpCz3jo5FRtkXhRftI VoS2whOuQXstuHPgxP2ElCXkq6yvFcxt9Minko89NXngpkE0LSTY73UXCUxu3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RX1zg45wYzpYx; Fri, 25 Aug 2023 01:08:31 +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 37P18Vrd058227; Fri, 25 Aug 2023 01:08:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37P18V3w058224; Fri, 25 Aug 2023 01:08:31 GMT (envelope-from git) Date: Fri, 25 Aug 2023 01:08:31 GMT Message-Id: <202308250108.37P18V3w058224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a6e48fe943dc - stable/13 - vm_map_growstack(): handle max protection for stacks 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6e48fe943dc93b113564401bc22214419192386 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6e48fe943dc93b113564401bc22214419192386 commit a6e48fe943dc93b113564401bc22214419192386 Author: Konstantin Belousov AuthorDate: 2023-07-25 13:56:29 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-25 01:06:44 +0000 vm_map_growstack(): handle max protection for stacks (cherry picked from commit aa928a52164fe57965491d63e57de66e9c078e1a) --- sys/vm/vm_map.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 9588f0591bcc..d4e4f2c89679 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4606,7 +4606,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, * object offset. */ gap_entry->next_read = sgp; - gap_entry->offset = prot; + gap_entry->offset = prot | PROT_MAX(max); } else { (void)vm_map_delete(map, bot, top); } @@ -4626,7 +4626,7 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) struct ucred *cred; vm_offset_t gap_end, gap_start, grow_start; vm_size_t grow_amount, guard, max_grow; - vm_prot_t prot; + vm_prot_t prot, max; rlim_t lmemlim, stacklim, vmemlim; int rv, rv1; bool gap_deleted, grow_down, is_procstack; @@ -4771,7 +4771,8 @@ retry: * The gap_entry "offset" field is overloaded. See * vm_map_stack_locked(). */ - prot = gap_entry->offset; + prot = PROT_EXTRACT(gap_entry->offset); + max = PROT_MAX_EXTRACT(gap_entry->offset); grow_start = gap_entry->end - grow_amount; if (gap_entry->start + grow_amount == gap_entry->end) { @@ -4785,7 +4786,7 @@ retry: gap_deleted = false; } rv = vm_map_insert(map, NULL, 0, grow_start, - grow_start + grow_amount, prot, prot, MAP_STACK_GROWS_DOWN); + grow_start + grow_amount, prot, max, MAP_STACK_GROWS_DOWN); if (rv != KERN_SUCCESS) { if (gap_deleted) { rv1 = vm_map_insert(map, NULL, 0, gap_start,