]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: Allow to execute from RAM
authorAlexander Graf <agraf@suse.de>
Fri, 22 Jun 2018 12:44:13 +0000 (14:44 +0200)
committerAlexander Graf <agraf@suse.de>
Sun, 23 Sep 2018 19:55:30 +0000 (21:55 +0200)
With efi_loader, we may want to execute payloads from RAM. By default,
permissions on the RAM region don't allow us to execute from there though.

So let's change the default allocation scheme for RAM to also allow
execution from it. That way payloads that live in U-Boot RAM can be
directly executed.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/sandbox/cpu/os.c

index bb075042ade21d00ed988611d85fca2f730d8072..9fbcb9ef92f77dce62ded400b549d79d9145d491 100644 (file)
@@ -146,7 +146,8 @@ void *os_malloc(size_t length)
        int page_size = getpagesize();
 
        hdr = mmap(NULL, length + page_size,
-                  PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+                  PROT_READ | PROT_WRITE | PROT_EXEC,
+                  MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
        if (hdr == MAP_FAILED)
                return NULL;
        hdr->length = length;