Open skmp opened 2 years ago
Quick note here, mmap + MAP_GROWSDOWN and mprotect + PROT_GROWSDOWN, mprotect + PROT_GROWSUP need to be also investigated w/ test cases
(also, is there a MAP_GROWSUP?)
As per the kernel source (5.17) MAP_GROWSUP is only defined for ia64, though it is ignored there.
VM_GROWSUP exists, and seems mostly implemented in mmap/mprotect, but no code maps MAP_GROWSUP to VM_GORWSUP.
VM_GROWSUP seems only implemented in ia64 fault handling.
As such, PROT_GROWSUP can never work.
Verified PROT_GROWSDOWN behaves as expected, it only changes protection downwards to the prev vma range.
Another edge case is madvise w/ MADV_DONTNEED, MADV_REMOVE, MADV_DONTFORK+MADV_DOFORK, MADV_HWPOISON, MADV_FREE, MADV_WIPEONFORK + MADV_KEEPONFORK.
It seems like MADV_FREE is impossible to be correctly implemented.
shmat, mremap are not tracked for smc.
Tests: https://github.com/FEX-Emu/fex-assorted-tests-bins/blob/main/src/smc-2.cpp
Looks like the shm size would have to be queried on map / unmap, similar to the tracking the 32-bit allocator does.