Chapter 9: Memory & Permission Management
Trusty OS provides robust memory and permission management mechanisms to ensure secure execution of trusted applications. This chapter covers three critical aspects of Trusty's security architecture.
Trusty uses memory partitioning to isolate secure and non-sesecure worlds. The memmap parameter defines memory regions during boot.
memmap=trusty@0x78000000$0x08000000 - Reserves 128MB for Trusty at 0x78000000Trusty implements a capability-based security model where access to resources is controlled through unforgeable tokens (capabilities).
// Example: Checking a capability
handle_t mem_cap = get_memory_capability();
if (!check_capability(mem_cap, CAP_ACCESS_READ)) {
return ERR_ACCESS_DENIED;
}
Trusty includes several design features to prevent Time-of-Check to Time-of-Use (TOCTOU) vulnerabilities.
// Safe file access pattern
handle_t file = open_file(path);
if (!validate_file(file)) {
close_handle(file); // Immediate cleanup
return ERR_INVALID;
}
// Use the validated handle
result = read_file(file);
close_handle(file); // Explicit cleanup
return result;
Trusty's memory and permission management provides a secure foundation for trusted applications:
These mechanisms work together to maintain the integrity of the Trusty execution environment while providing flexibility for application developers.