If the console is enabled. Don't write messages to the console page if it is disabled. Otherwise we would leak information if we disable the hypervisor.
Signed-off-by: Ralf Ramsauer <[email protected]> --- hypervisor/printk.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hypervisor/printk.c b/hypervisor/printk.c index aad6dadc..7b9cfd2a 100644 --- a/hypervisor/printk.c +++ b/hypervisor/printk.c @@ -23,7 +23,24 @@ struct jailhouse_console console __attribute__((section(".console"))); static DEFINE_SPINLOCK(printk_lock); -#define console_write(msg) arch_dbg_write(msg) +static void console_write(const char *msg) +{ + arch_dbg_write(msg); + + if (!console_print) + return; + + console.lock = true; + memory_barrier(); + while (*msg) { + console.content[console.tail % sizeof(console.content)] = + *msg++; + console.tail++; + } + console.lock = false; + memory_barrier(); +} + #include "printk-core.c" static void dbg_write_stub(const char *msg) -- 2.11.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
