LLD icon indicating copy to clipboard operation
LLD copied to clipboard

MMAP size issue.

Open ooogaboooga opened this issue 3 years ago • 0 comments

I am compiling this on Aarch64 (so this may just be an issue with cross compilation).

I have an issue with the mmap function call, when I pass the in_size + HEADER_SIZE_MASK the number received by the syscall mmap - when viewed with strace - is not what is expected. For example, if I printf the in_size + HEADER_SIZE_MASK I get 131067 but the value sent to the mmap syscall is 4295098363; which automatically fails as that's more ram than that is on my device. I know that the HEADER_SIZE_MASK is set to 0xFFFFFFF8 but why does it result in the memory size being over 4 gigabytes for a memory allocation?

Any ideas on why this occurs?

https://github.com/rockytriton/LLD/blob/62e5144be5db85f2ab109d94cd2ef5a8a3fb50e2/linux_os/part6/src/mylib/mem.c#L177

ooogaboooga avatar Aug 11 '21 11:08 ooogaboooga