ia64/xen-unstable

changeset 8960:2d3124df8a0e

Validate the segment selectors passed to arch_set_info_guest().

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
author Ian.Campbell@xensource.com
date Wed Feb 22 15:13:48 2006 +0000 (2006-02-22)
parents 229c602a075a
children 32a74fa9e221
files xen/arch/x86/domain.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Wed Feb 22 15:13:08 2006 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Wed Feb 22 15:13:48 2006 +0000
     1.3 @@ -356,9 +356,15 @@ int arch_set_info_guest(
     1.4       */
     1.5      if ( !(c->flags & VGCF_HVM_GUEST) )
     1.6      {
     1.7 -        if ( ((c->user_regs.cs & 3) == 0) ||
     1.8 -             ((c->user_regs.ss & 3) == 0) )
     1.9 +        if ( ((c->user_regs.ss & 3) == 0) ||
    1.10 +             !VALID_CODESEL(c->user_regs.cs) ||
    1.11 +             !VALID_CODESEL(c->event_callback_cs) ||
    1.12 +             !VALID_CODESEL(c->failsafe_callback_cs) )
    1.13              return -EINVAL;
    1.14 +
    1.15 +        for ( i = 0; i < 256; i++ )
    1.16 +            if ( !VALID_CODESEL(c->trap_ctxt[i].cs) )
    1.17 +                return -EINVAL;
    1.18      }
    1.19      else if ( !hvm_enabled )
    1.20        return -EINVAL;