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 <ag...@suse.de>

---

v4 -> v5:

  - Replace runtime mprotect() mechanism with mmap() flag
---
 arch/sandbox/cpu/os.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index fc2f9dbc7a..e3fe017b5f 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -144,7 +144,8 @@ void *os_malloc(size_t length)
 {
        struct os_mem_hdr *hdr;
 
-       hdr = mmap(NULL, length + sizeof(*hdr), PROT_READ | PROT_WRITE,
+       hdr = mmap(NULL, length + sizeof(*hdr),
+                  PROT_READ | PROT_WRITE | PROT_EXEC,
                   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
        if (hdr == MAP_FAILED)
                return NULL;
-- 
2.12.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to