Date: Fri, 25 Aug 2023 01:08:31 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a6e48fe943dc - stable/13 - vm_map_growstack(): handle max protection for stacks Message-ID: <202308250108.37P18V3w058224@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6e48fe943dc93b113564401bc22214419192386 commit a6e48fe943dc93b113564401bc22214419192386 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-07-25 13:56:29 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308250108.37P18V3w058224>