uVisor: platform specific SECURE_ALIAS_OFFSET is not applied to linker_exports.h

17 Aug 2017

CPU: armv8m

I got an error caused by invalid value of SECURE_ALIAS_OFFSET when running UVISOR_GET_NS_ALIAS() in uvisor_pool_init().

Because IDAU is disabled on my target, I set SECURE_ALIAS_OFFSET to zero in platform/my_target/configuration.h, but SECURE_ALIAS_OFFSET is still 0x10000000 as defined in linker_exports.h.

The platform specific configurations are not applied to linker_exports.h. To fix this problem, you can add header inclusion ,uvisor-config.h, to linker_export.h or add compile option to CFLAGS as following

diff --git a/uvisor/Makefile b/uvisor/Makefile
index 5bb73a0..925f9c9 100644
--- a/uvisor/Makefile
+++ b/uvisor/Makefile
@@ -181,7 +181,8 @@ CFLAGS_PRE:=\
         -I$(CORE_DIR) \
         $(foreach DIR, $(CORE_INC_DIRS), -I$(DIR)) \
         -ffunction-sections \
-        -fdata-sections
+        -fdata-sections \
+       -include $(CORE_DIR)/uvisor-config.h
diff --git a/api/inc/linker_exports.h b/api/inc/linker_exports.h                                         
index 2597fdc..e21af53 100644                                                                            
--- a/api/inc/linker_exports.h                                                                           
+++ b/api/inc/linker_exports.h                                                                           
@@ -20,11 +20,13 @@                                                                                      
 /* FIXME Consider supporting other aliasing schemes. This is dependent on the                           
  * IDAU implementation. Not all aliasing is guaranteed to work the same way. We            
  * currently only support a 1-bit MSB IDAU. */                                                          
+#ifndef SECURE_ALIAS_OFFSET                                                                             
 #if defined (ARCH_CORE_ARMv8M) || defined (TARGET_M33)                                                  
 #  define SECURE_ALIAS_OFFSET 0x10000000                                                                
 #else                                                                               
 #  define SECURE_ALIAS_OFFSET 0                                                                         
 #endif                                                            
+#endif
30 Aug 2017

I'd report this to uvisor github repo. I'm not sure who to ping about it otherwise.