Hello everyone, I was given; https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294912 and did some digging, and found that FreeBSD's Linuxulator did not follow Linux's behaviour when it came to unmapping memory. So I spent some time to implement it as Linux does, and this is the co-responding diff of the fix.
I should note that although I fixed this issue, the game in the original bug report still does not work, and will likely need quite a few more patches to work.
Thank you,
Sourojeet
Details
Details
To test this code I wrote a short script, compiled it using the Linux compiler (installed from linux-rl9-devtools), then marked it as a Linux binary, and ran it. It seemed to pass the test cases I wrote as far as I can tell, and the results are the same as on Linux.
#include <stdio.h>
#include <sys/mman.h>
#include <errno.h>
#include <unistd.h>
int main() {
size_t ps = getpagesize();
void *ptr = mmap(NULL, ps*2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if(munmap(ptr,0) != 0)
{
printf("Pass: Failed zero length test\n");
}
if(munmap(ptr+1,ps) != 0)
{
printf("Pass: Unaligned address failure\n");
}
if(munmap(ptr, 1) == 0)
{
printf("Pass: Partial length unmapped successfully\n");
}}
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
I did not originally include all the syscall.master files' changes, they've now been included, @Nimish Jain also helped point out that I could simplify the function quite a bit.