On 26.07.2024 17:22, Roger Pau Monne wrote: > With the stack mapped on a per-CPU basis there's no risk of other CPUs being > able to read the stack contents, but vCPUs running on the current pCPU could > read stack rubble from operations of previous vCPUs. > > The #DF stack is not zeroed because handling of #DF results in a panic. > > Signed-off-by: Roger Pau Monné <[email protected]> > --- > xen/arch/x86/include/asm/current.h | 30 +++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/x86/include/asm/current.h > b/xen/arch/x86/include/asm/current.h > index 75b9a341f814..02b4118b03ef 100644 > --- a/xen/arch/x86/include/asm/current.h > +++ b/xen/arch/x86/include/asm/current.h > @@ -177,6 +177,14 @@ unsigned long get_stack_dump_bottom (unsigned long sp); > # define SHADOW_STACK_WORK "" > #endif > > +#define ZERO_STACK \ > + "test %[stk_size], %[stk_size];" \ > + "jz .L_skip_zeroing.%=;" \ > + "std;" \ > + "rep stosb;" \ > + "cld;" \
Is ERMS actually helping with backwards copies? I didn't think so, and hence it may be that REP STOSQ might be more efficient here? Jan
