[libc-commits] [libc] [libc][mmap] force offset to long for mmap2 (PR #96522)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 24 15:57:36 PDT 2024
enh-google wrote:
> For Linux kernels, I'll only support kernels that kernel developers do (those listed on kernel.org). Though now I'm confused; does `mmap2` exist on 64b targets? That bionic code you cited above looks like it's always doing that shift on the offset. Is that right for 64b targets? I guess the man page for mmap mentions that mmap2 is used under the hood, but I guess I'm surprised to NOT set `__NR_mmap2` in /usr/include/asm/unistd_64.h.
that bionic code is in a file called legacy_32_bit_support.cpp :-) the LP64 architectures get just get an auto-generated assembler stub, but, yes, on LP64 the syscall is called `__NR_mmap`:
```
# (mmap only gets two lines because 32-bit bionic only uses the 64-bit call.)
void* __mmap2:mmap2(void*, size_t, int, int, int, long) lp32
void* mmap|mmap64(void*, size_t, int, int, int, off_t) lp64
```
(`__mmap2:mmap2` means "make a stub function called `__mmap2()` for the syscall `__NR_mmap2`"; `mmap|mmap64` means "make a stub function called `mmap()` for the syscall `__NR_mmap`, but also add an ELF alias called `mmap64()`".)
https://github.com/llvm/llvm-project/pull/96522
More information about the libc-commits
mailing list