summaryrefslogtreecommitdiffstats
path: root/loader/ldt_keeper.c
diff options
context:
space:
mode:
Diffstat (limited to 'loader/ldt_keeper.c')
-rw-r--r--loader/ldt_keeper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 6b28776501..bf61f617cf 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
+#include "osdep/mmap_anon.h"
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
@@ -200,8 +201,8 @@ ldt_fs_t* Setup_LDT_Keeper(void)
return NULL;
}
fs_seg=
- ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE,
- ldt_fs->fd, 0);
+ ldt_fs->fs_seg = mmap_anon(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, &ldt_fs->fd,
+ 0);
if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
@@ -286,6 +287,7 @@ void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
free(ldt_fs->prev_struct);
munmap((char*)ldt_fs->fs_seg, getpagesize());
ldt_fs->fs_seg = 0;
+ if (ldt_fs->fd != -1)
close(ldt_fs->fd);
free(ldt_fs);
}