[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 4/9] Clear AC bit in RFLAGS to protect Xen itself by SMAP




> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Tuesday, April 29, 2014 3:21 PM
> To: Wu, Feng
> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx; Dong, Eddie;
> Nakajima, Jun; Tian, Kevin; xen-devel@xxxxxxxxxxxxx
> Subject: RE: [PATCH v3 4/9] Clear AC bit in RFLAGS to protect Xen itself by 
> SMAP
> 
> >>> On 29.04.14 at 05:06, <feng.wu@xxxxxxxxx> wrote:
> 
> >
> >> -----Original Message-----
> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> >> Sent: Monday, April 28, 2014 5:58 PM
> >> To: Wu, Feng
> >> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx; Dong, Eddie;
> >> Nakajima, Jun; Tian, Kevin; xen-devel@xxxxxxxxxxxxx
> >> Subject: RE: [PATCH v3 4/9] Clear AC bit in RFLAGS to protect Xen itself by
> > SMAP
> >>
> >> >>> On 28.04.14 at 11:43, <feng.wu@xxxxxxxxx> wrote:
> >>
> >> >
> >> >> -----Original Message-----
> >> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> >> >> Sent: Monday, April 28, 2014 5:26 PM
> >> >> To: Wu, Feng
> >> >> Cc: andrew.cooper3@xxxxxxxxxx; ian.campbell@xxxxxxxxxx; Dong, Eddie;
> >> >> Nakajima, Jun; Tian, Kevin; xen-devel@xxxxxxxxxxxxx
> >> >> Subject: Re: [PATCH v3 4/9] Clear AC bit in RFLAGS to protect Xen 
> >> >> itself by
> >> > SMAP
> >> >>
> >> >> >>> On 28.04.14 at 05:15, <feng.wu@xxxxxxxxx> wrote:
> >> >> > @@ -466,6 +468,7 @@ ENTRY(dom_crash_sync_extable)
> >> >> >          jmp   asm_domain_crash_synchronous /* Does not
> return */
> >> >> >
> >> >> >  ENTRY(common_interrupt)
> >> >> > +        ASM_CLAC
> >> >> >          SAVE_ALL
> >> >> >          movq %rsp,%rdi
> >> >> >          callq do_IRQ
> >> >> > @@ -485,6 +488,7 @@ ENTRY(page_fault)
> >> >> >          movl  $TRAP_page_fault,4(%rsp)
> >> >> >  /* No special register assumptions. */
> >> >> >  GLOBAL(handle_exception)
> >> >> > +        ASM_CLAC
> >> >> >          SAVE_ALL
> >> >>
> >> >> Did you check whether the addition wouldn't better go right into
> >> >> SAVE_ALL?
> >> >
> >> > Most of them can be moved into SAVE_ALL obviously, however, there are
> two
> >> > exceptions:
> >> >
> >> > 1. SAVE_ALL is not executed in the beginning of some exception handlers,
> >> > such as, double_fault, nmi, etc.
> >>
> >> But that's orthogonal - I didn't say that would automatically cover
> >> _all_ cases.
> >
> > So, do you think we can move CLAC into SAVE_ALL in these cases? Thanks!
> 
> That was actually meant for you to figure out. But since you ask back,
> yes, I don't see any case where it would be outright wrong, but there
> are cases where it unnecessary, i.e. parameterizing SAVE_ALL might
> nevertheless be desirable.

Thanks for the suggestion. BTW, can we move SAVE_ALL into #ifdef __ASSEMBLY__ 
...... #endif,
since it is only used in assembly code?

> 
> >> > 2. We don't need CLAC in .fixup section where SAVE_ALL is used.
> >>
> >> Do we not?
> >
> > I think the AC bit is clear when running SAVE_ALL in the .fixup section.
> 
> Correct, but it would once again be harmless to do it here too.
> 
> Jan

Thanks,
Feng

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.