Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Feb 2024 20:08:03 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 277382] Wrong (or at least strange) stack growth for amd64 pthread stacks
Message-ID:  <bug-277382-227-rVErHyeLN6@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-277382-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277382

--- Comment #4 from Paul Floyd <pjfloyd@wanadoo.fr> ---
The mmap and mprotect are done in libth thr_stack.c

265                  /* Map the stack and guard page together, and split guard
266                     page from allocated space: */
267                  if ((stackaddr = mmap(stackaddr, stacksize + guardsize,
268                       _rtld_get_stack_prot(), MAP_STACK,
269                       -1, 0)) != MAP_FAILED &&
270                      (guardsize == 0 ||
271                       mprotect(stackaddr, guardsize, PROT_NONE) == 0)) {
272                          stackaddr += guardsize;

>From what I see that can the default can be overridden  with
_thr_attr_setguardsize but otherwise it is set to getpagesize().

Maybe libthr should check security.bsd.stack_guard_page and if it is 1 or more
not add the extra guard page.

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

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277382-227-rVErHyeLN6>