Message ID | 20180622124418.52892-7-agraf@suse.de |
---|---|
State | Accepted |
Commit | 613185023f0e84c410a2c088dd030ca696834763 |
Headers | show |
Series | sandbox: efi_loader support | expand |
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index e3fe017b5f..3067503d51 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -143,15 +143,16 @@ void os_tty_raw(int fd, bool allow_sigs) void *os_malloc(size_t length) { struct os_mem_hdr *hdr; + int page_size = getpagesize(); - hdr = mmap(NULL, length + sizeof(*hdr), + hdr = mmap(NULL, length + page_size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (hdr == MAP_FAILED) return NULL; hdr->length = length; - return hdr + 1; + return (void *)hdr + page_size; } void os_free(void *ptr)