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

Re: [Xen-devel] [PATCH v3 1/2] x86/hvm: Always do SMAP check when updating runstate_guest(v)



>>> On 29.07.14 at 10:42, <feng.wu@xxxxxxxxx> wrote:

> 
>> -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>> Sent: Tuesday, July 29, 2014 4:23 PM
>> To: Wu, Feng
>> Cc: linux@xxxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxx; keir@xxxxxxx;
>> tim@xxxxxxx 
>> Subject: RE: [PATCH v3 1/2] x86/hvm: Always do SMAP check when updating
>> runstate_guest(v)
>> 
>> >>> On 29.07.14 at 09:54, <feng.wu@xxxxxxxxx> wrote:
>> >> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
>> >> >>> On 08.01.01 at 23:52, <feng.wu@xxxxxxxxx> wrote:
>> >> > +        switch ( v->arch.smap_check_policy )
>> >> > +        {
>> >> > +        case SMAP_CHECK_HONOR_CPL_AC:
>> >> > +            hvm_get_segment_register(v, x86_seg_ss, &seg);
>> >> > +
>> >> > +            /*
>> >> > +             * SMAP: kernel-mode data accesses from user-mode
>> >> mappings
>> >> > +             * should fault.
>> >> > +             * A fault is considered as a SMAP violation if the 
>> >> > following
>> >> > +             * conditions come true:
>> >> > +             *   - X86_CR4_SMAP is set in CR4
>> >> > +             *   - A user page is accessed
>> >> > +             *   - CPL = 3 or X86_EFLAGS_AC is clear
>> >> > +             *   - Page fault in kernel mode
>> >> > +             */
>> >> > +            smap = hvm_smap_enabled(v) &&
>> >> > +                   ((seg.attr.fields.dpl == 3) ||
>> >> > +                   !(regs->eflags & X86_EFLAGS_AC));
>> >>
>> >> Indentation.
>> >
>> > Sorry, I don't find any indentation issue here. Do you mean
>> > "((seg.attr.fields.dpl == 3) ||" and "!(regs->eflags & X86_EFLAGS_AC));"
>> > are not indented with "hvm_smap_enabled(v) &&"? In fact they are in good
>> > indentation. Maybe it is the display that make it look
>> > like in wrong indentation?
>> 
>> No, I specifically checked in a mono-spaced font. The parentheses
>> around the || expression require its right side to be indented by one
>> more space than the very opening parenthesis.
> 
> In this case, do you mean I need to add another space before "!(regs->eflags 
> & 
> X86_EFLAGS_AC))"?

Exactly.

Jan


_______________________________________________
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®.