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

[Xen-devel] Ping: [PATCH 1/3] x86/HVM: introduce hvm_get_cpl() and respective hook



>>> On 06.12.16 at 12:43, <JBeulich@xxxxxxxx> wrote:
> --- a/xen/arch/x86/mm/guest_walk.c
> +++ b/xen/arch/x86/mm/guest_walk.c
> @@ -174,7 +174,6 @@ guest_walk_tables(struct vcpu *v, struct
>  
>      if ( is_hvm_domain(d) && !(pfec & PFEC_user_mode) )
>      {
> -        struct segment_register seg;
>          const struct cpu_user_regs *regs = guest_cpu_user_regs();
>  
>          /* SMEP: kernel-mode instruction fetches from user-mode mappings
> @@ -186,8 +185,6 @@ guest_walk_tables(struct vcpu *v, struct
>          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.
> @@ -199,8 +196,7 @@ guest_walk_tables(struct vcpu *v, struct
>               *   - Page fault in kernel mode
>               */
>              smap = hvm_smap_enabled(v) &&
> -                   ((seg.attr.fields.dpl == 3) ||
> -                    !(regs->eflags & X86_EFLAGS_AC));
> +                   ((hvm_get_cpl(v) == 3) || !(regs->eflags & 
> X86_EFLAGS_AC));
>              break;
>          case SMAP_CHECK_ENABLED:
>              smap = hvm_smap_enabled(v);

George, any word on these?

> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -1779,7 +1779,7 @@ void *sh_emulate_map_dest(struct vcpu *v
>  #ifndef NDEBUG
>      /* We don't emulate user-mode writes to page tables. */
>      if ( has_hvm_container_domain(d)
> -         ? hvm_get_seg_reg(x86_seg_ss, sh_ctxt)->attr.fields.dpl == 3
> +         ? hvm_get_cpl(v) == 3
>           : !guest_kernel_mode(v, guest_cpu_user_regs()) )
>      {
>          gdprintk(XENLOG_DEBUG, "User-mode write to pagetable reached "

Tim, how about this one?

Thanks, Jan


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

 


Rackspace

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