Skip to content

Restrict in memory mmap arguments to glibc on s390x#2060

Open
jogemu wants to merge 1 commit into
abseil:masterfrom
jogemu:patch-1
Open

Restrict in memory mmap arguments to glibc on s390x#2060
jogemu wants to merge 1 commit into
abseil:masterfrom
jogemu:patch-1

Conversation

@jogemu

@jogemu jogemu commented May 24, 2026

Copy link
Copy Markdown

DirectMmap fails for musl, because passing mmap arguments in memory is glibc specific.

@mkruskal-google

Copy link
Copy Markdown
Contributor

What about this code fails for musl? I'm not seeing something glibc-specific here

@jogemu

jogemu commented Jul 13, 2026

Copy link
Copy Markdown
Author

low_level_alloc.cc uses DirectMmap during runtime

new_pages = base_internal::DirectMmap(nullptr, new_pages_size,
PROT_WRITE|PROT_READ, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);

which returns MAP_FAILED with EINVAL

if (new_pages == MAP_FAILED) {
ABSL_RAW_LOG(FATAL, "mmap error: %d", errno);

[low_level_alloc.cc : 599] RAW: mmap error: 22 occurred during nodejs snapshot generation, which uses an older version that is permalinked above.

In musl mmap syscalls behave consistently with other 64-bit architectures, due to this condition: if (n == SYS_mmap) return __syscall1(n, (long)(long[]){a,b,c,d,e,f}); https://git.musl-libc.org/cgit/musl/tree/arch/s390x/syscall_arch.h#n64

Just for the s390x architecture, glibc still uses old_mmap to maintain backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants