microsoft / Komodo

Formally-verified reference monitor for a secure isolated execution ("enclave") environment on ARM TrustZone
https://www.microsoft.com/en-us/research/project/komodo/
Other
102 stars 28 forks source link

secure kernel init fails #11

Closed zatkh closed 6 years ago

zatkh commented 6 years ago

Just tried running komdo (not-verfied version) on qemu and it fails after initializing TTBR0 in secure_world_init func. I tried debugging it but gdb ignores my breakpoints (I set them after a short run and then interrupting) or for some functions shows "Cannot find bounds of current function" (maybe stack corruption?). Also serial_putc works but not console_puts for at least console debugging. -tried both (arm-none-eabi-) and (gcc-linaro-4.9-2016.02-x86_64_arm-eabi-) toolchains for compiling and gdb.

0xabu commented 6 years ago

Hmm, that code is in the bootloader, so it's the same regardless of whether you're using the verified or unverified monitor. Assuming you saw the "Final secure TTBR0/1" printf, it is most likely failing after enabling the MMU, which means there's something wrong about the page tables we've just installed.

Which QEMU are you using? I'd suggest trying the one from this branch: https://github.com/0xabu/qemu/tree/raspi-tzkludges

re. GDB, try using "hardware" breakpoints (set hbreak).

zatkh commented 6 years ago

I forgot to switch to qemu raspi-tzkludges branch, that fixed the problem (and also the gdb problem), thanks. The failed point was after reading ttbr not after setting sctlr.m for mmu enabling. So the security extension registers are not supported in qemu raspi branch?

0xabu commented 6 years ago

A normal raspi boots in normal-world, not secure-world, so those registers are inaccessible.