git: becaf6433be4 - main - Use vmspace->vm_stacktop in place of sv_usrstack in more places.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 14 Feb 2022 18:58:14 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=becaf6433be4a7c86e8053d42f399176c24d76b6 commit becaf6433be4a7c86e8053d42f399176c24d76b6 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-02-14 18:57:30 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-02-14 18:57:30 +0000 Use vmspace->vm_stacktop in place of sv_usrstack in more places. Reviewed by: markj Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D34174 --- sys/compat/linux/linux_mmap.c | 2 +- sys/kern/kern_resource.c | 4 ++-- sys/vm/vm_map.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c index af2ccc74ba12..4e53f3255b07 100644 --- a/sys/compat/linux/linux_mmap.c +++ b/sys/compat/linux/linux_mmap.c @@ -176,7 +176,7 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot, * mmap's return value. */ PROC_LOCK(p); - vms->vm_maxsaddr = (char *)p->p_sysent->sv_usrstack - + vms->vm_maxsaddr = (char *)round_page(vms->vm_stacktop) - lim_cur_proc(p, RLIMIT_STACK); PROC_UNLOCK(p); } diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 0c1fd4303d3d..6ffd1bb379b2 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -770,12 +770,12 @@ kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, if (limp->rlim_cur > oldssiz.rlim_cur) { prot = p->p_sysent->sv_stackprot; size = limp->rlim_cur - oldssiz.rlim_cur; - addr = p->p_sysent->sv_usrstack - + addr = round_page(p->p_vmspace->vm_stacktop) - limp->rlim_cur; } else { prot = VM_PROT_NONE; size = oldssiz.rlim_cur - limp->rlim_cur; - addr = p->p_sysent->sv_usrstack - + addr = round_page(p->p_vmspace->vm_stacktop) - oldssiz.rlim_cur; } addr = trunc_page(addr); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 8d654f5ac612..2efefd16defb 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4664,7 +4664,7 @@ retry: * limit. */ is_procstack = addr >= (vm_offset_t)vm->vm_maxsaddr && - addr < (vm_offset_t)p->p_sysent->sv_usrstack; + addr < (vm_offset_t)vm->vm_stacktop; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) return (KERN_NO_SPACE);