From: Tim Deegan Subject: Re: [Patch v2 3/3] xen/gdbsx: Security audit of {, un}pausevcpu and domstatus hypercalls Date: Thu, 24 Jul 2014 13:41:59 +0200 Message-ID: <20140724114159.GE1821@deinos.phlegethon.org> References: <20140724110746.GC1821@deinos.phlegethon.org> <1406200565-21913-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1406200565-21913-1-git-send-email-andrew.cooper3@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 , Xen-devel , Jan Beulich List-Id: xen-devel@lists.xenproject.org At 12:16 +0100 on 24 Jul (1406200565), Andrew Cooper wrote: > XEN_DOMCTL_gdbsx_domstatus is already safe. It loops at most over every vcpu > in a domain and breaks at the first vcpu with an event pending, marking it as > not-pending. > > XEN_DOMCTL_gdbsx_pausevcpu had an incorrect bounds check against the vcpu id, > allowing an overflow of d->vcpu[] with an id between d->max_vcpus and > MAX_VIRT_CPUS. It was also able to overflow a vcpus pause count by many > repeated hypercalls. > > The bounds check is fixed, and vcpu_pause() has been replaced with > vcpu_pause_by_systemcontroller() which cuts out at 255 uses. > > XEN_DOMCTL_gdbsx_unpausevcpu suffered from the same bounds problems as its > pause counterpart, and is fixed in exactly the same way. Despite the > atomic_read(&v->pause_count), this code didn't successfully prevent against an > underflow of the vcpu pause count. > > The vcpu_unpause() has been replaced with vcpu_pause_by_systemcontroller() > which correctly prevents against underflow. The printk() is updated to have a > proper guest logging level, and provide more useful information in the XSM > case of one domain having debugger privileges over another. > > Signed-off-by: Andrew Cooper Reviewed-by: Tim Deegan