[Bug 260303] lang/sdcc: seg fault during build (ASLR fallout)

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 10 Dec 2021 14:51:49 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260303

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Andrew@FreeBSD.org

--- Comment #3 from Dimitry Andric <dim@FreeBSD.org> ---
I'm testing Andrew's suggestion of:

diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 793ded63d91c..8ee98473159c 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -672,8 +672,12 @@ 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;
+       if (which == RLIMIT_STACK) {
+               if (limp->rlim_cur != RLIM_INFINITY)
+                       limp->rlim_cur += p->p_vmspace->vm_stkgap;
+               if (limp->rlim_max != RLIM_INFINITY)
+                       limp->rlim_max += p->p_vmspace->vm_stkgap;
+       }

        oldssiz.rlim_cur = 0;
        newlim = lim_alloc();

-- 
You are receiving this mail because:
You are the assignee for the bug.