The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=642dd17ee94377c3d5533d05d0d9a58b88f60387
commit 642dd17ee94377c3d5533d05d0d9a58b88f60387 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-05-07 16:00:31 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-05-07 17:00:14 +0000 vm_map_growstack(): consistently use local vars instead of curthread/proc Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D56863 --- sys/vm/vm_map.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 63bdce9d60f8..0a81e62d2d63 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4731,6 +4731,7 @@ static int vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) { vm_map_entry_t stack_entry; + struct thread *td; struct proc *p; struct vmspace *vm; vm_offset_t gap_end, gap_start, grow_start; @@ -4746,7 +4747,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) int error __diagused; #endif - p = curproc; + td = curthread; + p = td->td_proc; vm = p->p_vmspace; /* @@ -4760,9 +4762,9 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) MPASS(!vm_map_is_system(map)); - lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); - stacklim = lim_cur(curthread, RLIMIT_STACK); - vmemlim = lim_cur(curthread, RLIMIT_VMEM); + lmemlim = lim_cur(td, RLIMIT_MEMLOCK); + stacklim = lim_cur(td, RLIMIT_STACK); + vmemlim = lim_cur(td, RLIMIT_VMEM); retry: /* If addr is not in a hole for a stack grow area, no need to grow. */ if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) @@ -4778,8 +4780,8 @@ retry: } else { return (KERN_FAILURE); } - guard = ((curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 || - (curproc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : + guard = ((p->p_flag2 & P2_STKGAP_DISABLE) != 0 || + (p->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow)
