From: Paul Durrant Subject: [PATCH v2 3/3] x86/hvm: Use white-lists for HVM param guest accessibility checks Date: Fri, 1 May 2015 15:05:41 +0100 Message-ID: <1430489141-27602-5-git-send-email-paul.durrant@citrix.com> References: <1430489141-27602-1-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YoBZf-0001AI-Iq for xen-devel@lists.xenproject.org; Fri, 01 May 2015 14:05:51 +0000 In-Reply-To: <1430489141-27602-1-git-send-email-paul.durrant@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: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Paul Durrant , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org There are actually very few HVM parameters that a guest needs to read and even fewer that a guest needs to write. Use white-lists to specify those parameters and also ensre that, by default, newly introduced parameters are not accessible. Signed-off-by: Paul Durrant Cc: Keir Fraser Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 1025681..3725349 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5648,25 +5648,18 @@ static int hvm_allow_set_param(struct domain *d, if ( rc ) return rc; - /* The following parameters cannot be set by the guest. */ + /* The following parameters can be set by the guest. */ switch ( a->index ) { - case HVM_PARAM_IDENT_PT: - case HVM_PARAM_DM_DOMAIN: - case HVM_PARAM_ACPI_S_STATE: - case HVM_PARAM_VIRIDIAN: - case HVM_PARAM_MEMORY_EVENT_CR0: - case HVM_PARAM_MEMORY_EVENT_CR3: - case HVM_PARAM_MEMORY_EVENT_CR4: - case HVM_PARAM_MEMORY_EVENT_INT3: - case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP: - case HVM_PARAM_MEMORY_EVENT_MSR: - case HVM_PARAM_IOREQ_SERVER_PFN: - case HVM_PARAM_NR_IOREQ_SERVER_PAGES: - if ( d == current->domain ) - rc = -EPERM; + case HVM_PARAM_CALLBACK_IRQ: + case HVM_PARAM_VM86_TSS: + case HVM_PARAM_ACPI_IOPORTS_LOCATION: + case HVM_PARAM_TRIPLE_FAULT_REASON: + case HVM_PARAM_VM_GENERATION_ID_ADDR: break; default: + if ( d == current->domain ) + rc = -EPERM; break; } @@ -5870,15 +5863,22 @@ static int hvm_allow_get_param(struct domain *d, if ( rc ) return rc; - /* The following parameters should not be read by the guest. */ + /* The following parameters can be read by the guest. */ switch ( a->index ) { - case HVM_PARAM_IOREQ_SERVER_PFN: - case HVM_PARAM_NR_IOREQ_SERVER_PAGES: - if ( d == current->domain ) - rc = -EPERM; + case HVM_PARAM_CALLBACK_IRQ: + case HVM_PARAM_VM86_TSS: + case HVM_PARAM_ACPI_IOPORTS_LOCATION: + case HVM_PARAM_TRIPLE_FAULT_REASON: + case HVM_PARAM_VM_GENERATION_ID_ADDR: + case HVM_PARAM_STORE_PFN: + case HVM_PARAM_STORE_EVTCHN: + case HVM_PARAM_CONSOLE_PFN: + case HVM_PARAM_CONSOLE_EVTCHN: break; default: + if ( d == current->domain ) + rc = -EPERM; break; } -- 1.7.10.4