[Bug 277382] Wrong (or at least strange) stack growth for amd64 pthread stacks
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 277382] Wrong stack growth for amd64 pthread stacks"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Feb 2024 20:08:03 UTC
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.