Module: xenomai-3
Branch: stable-3.0.x
Commit: ac450df25221ee4ccb954fbf667ef0e96a0b6ff4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ac450df25221ee4ccb954fbf667ef0e96a0b6ff4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Nov 10 15:47:57 2015 +0100

cobalt/posix/process: fix mayday mapping denial on NOMMU

Until we stop backing /dev/mem with the mayday page, we can't ask for
PROT_EXEC on NOMMU, since the former does not define mmap
capabilities, and default ones won't allow an executable mapping with
MAP_SHARED. In the NOMMU case, this is (currently) not an issue for
implementing the MAYDAY support.

---

 kernel/cobalt/posix/process.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index c5a3297..46fe764 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -590,6 +590,11 @@ static inline int disable_ondemand_memory(void)
        return __ipipe_disable_ondemand_mappings(p);
 }
 
+static inline int get_mayday_prot(void)
+{
+       return PROT_READ|PROT_EXEC;
+}
+
 #else /* !CONFIG_MMU */
 
 static inline int disable_ondemand_memory(void)
@@ -597,6 +602,18 @@ static inline int disable_ondemand_memory(void)
        return 0;
 }
 
+static inline int get_mayday_prot(void)
+{
+       /*
+        * Until we stop backing /dev/mem with the mayday page, we
+        * can't ask for PROT_EXEC since the former does not define
+        * mmap capabilities, and default ones won't allow an
+        * executable mapping with MAP_SHARED. In the NOMMU case, this
+        * is (currently) not an issue.
+        */
+       return PROT_READ;
+}
+
 #endif /* !CONFIG_MMU */
 
 /**
@@ -1277,7 +1294,7 @@ static inline unsigned long map_mayday_page(void)
 
        mayday_page = xnarch_get_mayday_page();
        ret = rtdm_mmap_to_user(NULL, mayday_page, PAGE_SIZE,
-                               PROT_READ|PROT_EXEC, &u_addr, NULL, NULL);
+                               get_mayday_prot(), &u_addr, NULL, NULL);
        if (ret)
                return 0UL;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to