Skip to content

AArch64 executables allocate huge stack #2

@compor

Description

@compor

AArch64 executables as statically linked by our toolchain using musl libc seem to allocate a huge stack.

This causes gdb to hang during coredump generation since it is forced to write to the coredump file a huge VMA (in the order of hundreds of GBs) for the stack allocation.

Output of cat /proc/[pid]/maps:

004f0000-004f1000 r--p 00000000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00500000-00507000 r-xp 00100000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00600000-00602000 r--p 00200000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00700000-00702000 rw-p 00300000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00800000-00802000 rw-p 00000000 00:00 0
00900000-00901000 r--p 00400000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00a00000-00a01000 r--p 00500000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
00a01000-00a03000 rw-p 00501000 08:12 2901681                            /home/vasil/migration/call_leaf_aarch64_aligned.out
7ffffeffd000-7fffffffd000 rw-p 00000000 00:00 0
7fffffffd000-7ffffffff000 r--p 00000000 00:00 0                          [vvar]
7ffffffff000-800000000000 r-xp 00000000 00:00 0                          [vdso]
800000000000-fffffffdf000 ---p 00000000 00:00 0   <------------ stack allocation!

Output of cat /proc/[pid]/smaps:

800000000000-fffffffdf000 ---p 00000000 00:00 0
Size:           137438953340 kB   <--------------------------------- this is several gigabytes!
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:             0 kB
LazyFree:              0 kB
AnonHugePages:         0 kB
ShmemPmdMapped:        0 kB
FilePmdMapped:         0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
THPeligible:    0
VmFlags: mr mw me

In contrast, the corresponding X86 executable seems to have a normal stack size that is also properly identified as such:

7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]
Size:                132 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                  12 kB
Pss:                  12 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:        12 kB
Referenced:           12 kB
Anonymous:            12 kB
LazyFree:              0 kB
AnonHugePages:         0 kB
ShmemPmdMapped:        0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
THPeligible:    1
ProtectionKey:         0
VmFlags: rd wr mr mw me gd ac

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions