[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 18:23:53 UTC 2021


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

--- Comment #10 from Alex S <iwtcex at gmail.com> ---
(In reply to Conrad Meyer from comment #8)

I noticed neither Linux nor FreeBSD actually bothers with accurate
stack mappings in /proc/self/map. About multiple threads Linux's
documentation plainly states "[stack:<tid>] (from Linux 3.4 to 4.4) …
This field was removed in Linux 4.5, since providing this information
for a process with large numbers of threads is expensive."

However, this looks a bit fishy even with a basic single-threaded test:

xubuntu at xubuntu:~$ cat address.c 
#define _GNU_SOURCE

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
  int i = 1;
  fprintf(stderr, "[[%p]]\n", &i);
  system("cat /proc/self/maps | tail -n 5");
  return 0;
}
xubuntu at xubuntu:~$ gcc address.c -o test
xubuntu at xubuntu:~$ ./test
[[0x7ffe7a0cbca4]]
7f4f3c7af000-7f4f3c7b0000 rw-p 00000000 00:00 0 
7ffe37e2e000-7ffe37e4f000 rw-p 00000000 00:00 0                         
[stack]
7ffe37fd0000-7ffe37fd3000 r--p 00000000 00:00 0                          [vvar]
7ffe37fd3000-7ffe37fd4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0                 
[vsyscall]

I mean, 0x7ffe7a0cbca4 is right between [vdso] and [vsyscall].

Since apparently we are already in the pure fantasy land,
it's probably not a big deal to mess this a bit more.

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


More information about the freebsd-emulation mailing list