git: 5a8413e779a2 - main - setrlimit: Remove special handling for RLIMIT_STACK with a stack gap

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 17 Jan 2022 21:13:06 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a8413e779a2258b02f92bad69a03d283c4bf2a6

commit 5a8413e779a2258b02f92bad69a03d283c4bf2a6
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-01-17 16:42:13 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-01-17 16:42:13 +0000

    setrlimit: Remove special handling for RLIMIT_STACK with a stack gap
    
    This will not be required with a forthcoming reimplementation of ASLR
    stack randomization.  Moreover, this change was not sufficient to enable
    the use of a stack size limit smaller than the stack gap itself.
    
    PR:             260303
    Reviewed by:    kib
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D33704
---
 sys/kern/kern_resource.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 527e7f16e297..504e338ba922 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -672,9 +672,6 @@ kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which,
 	if (limp->rlim_max < 0)
 		limp->rlim_max = RLIM_INFINITY;
 
-	if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY)
-		limp->rlim_cur += p->p_vmspace->vm_stkgap;
-
 	oldssiz.rlim_cur = 0;
 	newlim = lim_alloc();
 	PROC_LOCK(p);