[Bug 253337] Linuxulator: glibc's pthread_getattr_np reports stack size as 124K

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Feb 13 17:16:47 UTC 2021


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

--- Comment #7 from Conrad Meyer <cem at freebsd.org> ---
In exec, we map the stack with vm_map_stack() with rlim_cur (I think); in
vm_map_stack, we set the init_ssize with MIN(sysctl kern.sgrowsiz, rlim_cur).  

kern.sgrowsiz is 128kB.

There's a comment about the behavior in vm/vm_map.c:4565.  At line 4585 we
insert the normal stack mapping.  At line 4599 we insert the reservation for
the unallocated portion of the stack with no access (---).

We won't insert the --- mapping if gap_bot == gap_top, which I think only
happens if kern.sgrowsiz happens to match the stack rlimit.rl_cur.

So... a crappy workaround here might be to set kern.sgrowsiz to 8MB. 
Obviously, that's system-wide, and doesn't chase rlim_cur.  I'm not sure of the
ramifications.  I don't think this actually faults in backing physical memory
pages, and both RW- and no-prot (---) pages consume the same amount of virtual
memory.  So it might be pretty harmless.

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


More information about the freebsd-emulation mailing list