lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 20 Jul 2009 20:44:09 -0300
From:	Marcelo Tosatti <mtosatti@...hat.com>
To:	Akinobu Mita <akinobu.mita@...il.com>
Cc:	linux-kernel@...r.kernel.org, Avi Kivity <avi@...hat.com>,
	kvm@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 1/2] kvm: use get_desc_base() and get_desc_limit()

On Sat, Jul 18, 2009 at 11:58:32PM +0900, Akinobu Mita wrote:
> Use get_desc_base() and get_desc_limit() to get the base address and
> limit in desc_struct.
> 
> Cc: Avi Kivity <avi@...hat.com>
> Cc: kvm@...r.kernel.org
> Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
> ---

Applied both, thanks.

>  arch/x86/kvm/x86.c |   18 +++++-------------
>  1 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index fe5474a..38d9b53 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -132,8 +132,7 @@ unsigned long segment_base(u16 selector)
>  		table_base = segment_base(ldt_selector);
>  	}
>  	d = (struct desc_struct *)(table_base + (selector & ~7));
> -	v = d->base0 | ((unsigned long)d->base1 << 16) |
> -		((unsigned long)d->base2 << 24);
> +	v = get_desc_base(d);
>  #ifdef CONFIG_X86_64
>  	if (d->s == 0 && (d->type == 2 || d->type == 9 || d->type == 11))
>  		v |= ((unsigned long)((struct ldttss_desc64 *)d)->base3) << 32;
> @@ -3617,11 +3616,8 @@ static void kvm_set_segment(struct kvm_vcpu *vcpu,
>  static void seg_desct_to_kvm_desct(struct desc_struct *seg_desc, u16 selector,
>  				   struct kvm_segment *kvm_desct)
>  {
> -	kvm_desct->base = seg_desc->base0;
> -	kvm_desct->base |= seg_desc->base1 << 16;
> -	kvm_desct->base |= seg_desc->base2 << 24;
> -	kvm_desct->limit = seg_desc->limit0;
> -	kvm_desct->limit |= seg_desc->limit << 16;
> +	kvm_desct->base = get_desc_base(seg_desc);
> +	kvm_desct->limit = get_desc_limit(seg_desc);
>  	if (seg_desc->g) {
>  		kvm_desct->limit <<= 12;
>  		kvm_desct->limit |= 0xfff;
> @@ -3700,11 +3696,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
>  static u32 get_tss_base_addr(struct kvm_vcpu *vcpu,
>  			     struct desc_struct *seg_desc)
>  {
> -	u32 base_addr;
> -
> -	base_addr = seg_desc->base0;
> -	base_addr |= (seg_desc->base1 << 16);
> -	base_addr |= (seg_desc->base2 << 24);
> +	u32 base_addr = get_desc_base(seg_desc);
>  
>  	return vcpu->arch.mmu.gva_to_gpa(vcpu, base_addr);
>  }
> @@ -3993,7 +3985,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
>  		}
>  	}
>  
> -	if (!nseg_desc.p || (nseg_desc.limit0 | nseg_desc.limit << 16) < 0x67) {
> +	if (!nseg_desc.p || get_desc_limit(&nseg_desc) < 0x67) {
>  		kvm_queue_exception_e(vcpu, TS_VECTOR, tss_selector & 0xfffc);
>  		return 1;
>  	}
> -- 
> 1.6.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ