On 2017-01-19 21:11, Ralf Ramsauer wrote: > 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 | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/hypervisor/printk.c b/hypervisor/printk.c > index 117fe74c96..63faed1d39 100644 > --- a/hypervisor/printk.c > +++ b/hypervisor/printk.c > @@ -23,7 +23,26 @@ volatile 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 (!virtual_console) > + return; > + > + console.lock = true; > + /* ensure the lock is visible prior to updates of the content */ > + memory_barrier(); > + while (*msg) { > + console.content[console.tail % sizeof(console.content)] = > + *msg++; > + console.tail++; > + } > + /* ensure that all updates are committed before releasing the lock */ > + memory_barrier(); > + console.lock = false; > +} > + > #include "printk-core.c" > > static void dbg_write_stub(const char *msg) >
Reviewed-by: Jan Kiszka <[email protected]> -- 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.
