Skip to content

Conversation

@alexhoppus
Copy link
Contributor

Building OP-TEE with core AddressSanitizer enabled
(CFG_CORE_SANITIZE_KADDRESS) increases MMU translation table usage.

This is caused by ASan shadow regions and by the
overall growth of the core memory layout: code, data and stack
regions become larger, which often forces additional page table splits
and results in a higher number of xlat tables being allocated during
early boot.

With the current MAX_XLAT_TABLES calculation, some ASan-enabled builds
can exhaust the xlat table pool and panic in core_mmu_map_pages() with
xlat tables exhausted.

I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are enabled
D/TC:1   atomic_console_notif:158 Asynchronous notifications started, event 0 (vm 0)
E/TC:1 0 core_mmu_xlat_table_alloc:702 5 xlat tables exhausted
E/TC:1 0 Panic 'Failed to spread pgdir on small tables' at core/mm/core_mmu.c:2087 <core_mmu_map_pages>
E/TC:1 0 TEE load address @ 0xe100000
E/TC:1 0 Call stack:
E/TC:1 0  0x0e10d130
E/TC:1 0  0x0e13384c
E/TC:1 0  0x0e153bd0
E/TC:1 0  0x0e159c84
E/TC:1 0  0x0e159168
E/TC:1 0  0x0e15a764
E/TC:1 0  0x0e1089d0
E/TC:1 0  0x0e108da4
E/TC:1 0  0x0e108e30
I/TC: Halting CPU 0

@alexhoppus alexhoppus force-pushed the asan-7 branch 3 times, most recently from 947b71c to a586d33 Compare December 30, 2025 21:53
XLAT_TABLE_VIRTUALIZATION_EXTRA + \
XLAT_TABLE_ASLR_EXTRA + \
XLAT_TABLE_USER_EXTRA + \
XLAT_TABLE_ASAN_EXTRA + \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified as IS_ENABLED(CFG_CORE_SANITIZE_KADDRESS).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jenswi-linaro
Copy link
Contributor

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Enabling CFG_CORE_SANITIZE_KADDRESS increases MMU translation
table usage in multiple ways. In addition to ASan shadow regions,
the overall size of the core image grows, including code, data,
and stack mappings. This often leads to additional page table splits
and higher xlat table consumption.

Signed-off-by: Aleksandr Iashchenko <aleksandr.iashchenko@linutronix.de>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants