From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [Patch v2 3/3] xen/gdbsx: Security audit of {, un}pausevcpu and domstatus hypercalls Date: Thu, 24 Jul 2014 18:20:09 -0700 Message-ID: <20140724182009.5a22218d@mantra.us.oracle.com> References: <20140724110746.GC1821@deinos.phlegethon.org> <1406200565-21913-1-git-send-email-andrew.cooper3@citrix.com> <53D11F0002000078000258A4@mail.emea.novell.com> <53D103F3.2010604@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53D103F3.2010604@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Ian Campbell , Ian Jackson , Tim Deegan , Xen-devel , Jan Beulich List-Id: xen-devel@lists.xenproject.org On Thu, 24 Jul 2014 14:02:43 +0100 Andrew Cooper wrote: > On 24/07/14 13:58, Jan Beulich wrote: > >>>> On 24.07.14 at 13:16, wrote: > >> --- a/xen/arch/x86/domctl.c > >> +++ b/xen/arch/x86/domctl.c > >> @@ -1030,11 +1030,10 @@ long arch_do_domctl( > >> if ( !d->controller_pause_count ) > >> break; > >> ret = -EINVAL; > >> - if ( domctl->u.gdbsx_pauseunp_vcpu.vcpu >= MAX_VIRT_CPUS > >> || > >> + if ( domctl->u.gdbsx_pauseunp_vcpu.vcpu >= d->max_vcpus || > > As mentioned on IRC - are you sure you can replace (rather than > > amend) the previous bounds check? I.e. do you _know_ that gdbsx > > can deal with guests having more than MAX_VIRT_CPUS vCPU-s? > > > > Jan > > > > I have no idea whether it can or not, but if it asks for a legitimate > ID greater than MAX_VIRT_CPUS, then I think it is reasonable to > assume yes. In earlier days, gdbsx was not part of xen. So I, in my earlier xen days, added call to unpause a vcpu with INTMAX (~0u) vcpuid, and see if xen returns ENOSYS. The above change doesn't affect that, and it is good to check for d->max_vcpus instead of MAX_VIRT_CPUS. vcpuid in gdbsx is int, so it can handle INTMAX-1 vcpus, it thinks INTMAX is invalid vcpu :). thanks, mukesh