Re: [PATCH] x86/speculation/mds: Flush store buffer after wake up from sleep

From: Thomas Gleixner
Date: Fri Jun 21 2019 - 13:19:26 EST


On Wed, 19 Jun 2019, Zhenzhong Duan wrote:

> Intel document says: "When a thread wakes from a sleep state, the store
> buffer is repartitioned again. This causes the store buffer to transfer
> store buffer entries from the thread that was already active to the one
> which just woke up."
>
> To avoid data leak from sibling thread to the woken thread, flush store
> buffer right after wake up.

That's a pointless exercise. The buffers are flushed again when returning
to user space. Inside the kernel the potential leak is completely
uninteresting unless you consider the kernel as a malicious entity.

> Move mds_idle_clear_cpu_buffers() after trace_hardirqs_on() to ensure
> all store buffer entries are flushed before sleep.

I'm fine with that change, albeit trace_hardirqs_on() is hardly leaking
somethimg interesting.

Thanks,

tglx