seL4 / seL4

The seL4 microkernel
https://sel4.systems
Other
4.75k stars 672 forks source link

arm64: silent asserts before mapping the kernel window #1191

Open andybui01 opened 9 months ago

andybui01 commented 9 months ago

This might not be a big problem, but it's just something I've encountered while debugging the kernel.

Between the elfloader jumping to the kernel and mapping the kernel window, printing is effectively disabled as the kernel UART drivers use a UART_PPTR virtual address. This means that when an assert fails the user may experience kernel "hanging" without any definite reason/clues as to why.

The workaround for this is to change the UART VA to the PA value instead, as the elfloader identity mapping will still be active at this point (mapping the kernel window).

Just wondering if a debug early-UART implementation that makes use of the elfloader 1:1 mapping makes sense.

Side note: similarly, there is a small gap between activate_kernel_vspace() and setVtable(). In this gap, the elfloader vtable will no longer be useable, and we may miss exceptions.

Ivan-Velickovic commented 9 months ago

Is this a duplicate of https://github.com/seL4/seL4/issues/540?

andybui01 commented 9 months ago

Is this a duplicate of https://github.com/seL4/seL4/issues/540?

Woops, seems like it, I'm happy to close this.

Is there any real preference for a potential fix here? Since this seems to be a known thing I can work on a patch for this?

Indanz commented 9 months ago

If using the 1:1 mapping is possible, your solution is better though.