git: 1a97674b4637 - stable/13 - setrlimit: Remove special handling for RLIMIT_STACK with a stack gap

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 24 Jan 2022 14:21:03 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a97674b4637d07189fca0d4d8cea29bcf0d0efa

commit 1a97674b4637d07189fca0d4d8cea29bcf0d0efa
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-01-17 16:42:13 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-01-24 14:16:52 +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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 5a8413e779a2258b02f92bad69a03d283c4bf2a6)
---
 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 ed15f02eedbc..0ea863917727 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);