Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp438261imm; Wed, 13 Jun 2018 02:59:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI1agISGiJF8LYF5YQEufegCRfbhAXRwGyENBK7BMTjUCWX3b5+oHC0FTTCt2+MkNRVTd1r X-Received: by 2002:a65:6356:: with SMTP id p22-v6mr3570341pgv.20.1528883974524; Wed, 13 Jun 2018 02:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528883974; cv=none; d=google.com; s=arc-20160816; b=vEEYWnwwEhOmfGOugoZNklVqjGSZF+Ak7EyZ0OpyY8qaZY/UZlGzM+rLZkGXggIxNW hZPULO+luoPGBbW0bRRPfBT4ToeS4UMY6R+moWTymcsDXZUtvmJXBUGg6Ox4Uk1SYCwj N7q/lXA/dJU/BakKY9CcSU8ZO6JHRVi4NFQIGF2dretBqOVInxDIVjvUORUh++yKOBij dFBR+BHLSBFTUFpKyq58MWjmIYUnT8AjHjYmmfCt9JXxgtZs3RWEmsAiGLjNYD+JbDSH l6ElOQ3/FaUv2HrV9wpuecQNLZqeGezckmA6hYKiv5OnVhxq9nkyYLXMgZ9vbv44nEeq 6yBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hzdNefdBqeS62G3/0IMhA3SGZOXB1ffFi7q7YO2Gq5U=; b=TVsMjoeqCcBG0YgDveVS/1f8mhD/xZc6trmconslbhLpe9HKmXlrxMHwH7sLXYDq3n VnNBmSLe7XsyVZ6pdJNUxDMNRQfSjl6IZVqXsnYFigtKf28V7t2VQEHTDmc90Nyjas+h OZcWQQ0x8+aiKcDTjN5tDJk3pEbhLlpFRHgpJcqWhWK6Pjin8RGv+padbSR1Eo48icN8 2rOZQ7OVvvMQcp/O4jV4cVwnSBOAKoW57Dl8E/WE59cR6ONg+qMDZrOW8fzw1Fa289Zm YXVrjSjHW2WBzOP58pmQwL5DINqUbQ4b37XRYTD/bzHu/KqLiEN+PTVMBDejcKMFPJ+e H2lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si2513211plq.82.2018.06.13.02.59.20; Wed, 13 Jun 2018 02:59:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935202AbeFMJ6M (ORCPT + 99 others); Wed, 13 Jun 2018 05:58:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:54638 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934279AbeFMJ6K (ORCPT ); Wed, 13 Jun 2018 05:58:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A3C63AC1E; Wed, 13 Jun 2018 09:58:09 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: boris.ostrovsky@oracle.com, Juergen Gross Subject: [PATCH] xen: don't use privcmd_call() from xen_mc_flush() Date: Wed, 13 Jun 2018 11:58:06 +0200 Message-Id: <20180613095806.2978-1-jgross@suse.com> X-Mailer: git-send-email 2.13.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using privcmd_call() for a singleton multicall seems to be wrong, as privcmd_call() is using stac()/clac() to enable hypervisor access to Linux user space. Add a new xen_single_call() function to be use for that purpose. Reported-by: Jan Beulich Signed-off-by: Juergen Gross --- arch/x86/include/asm/xen/hypercall.h | 25 +++++++++++++++++++------ arch/x86/xen/multicalls.c | 6 +++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index bfd882617613..6b2f90a0b149 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h @@ -209,24 +209,37 @@ extern struct { char _entry[32]; } hypercall_page[]; }) static inline long -privcmd_call(unsigned call, - unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, - unsigned long a5) +xen_single_call(unsigned int call, + unsigned long a1, unsigned long a2, + unsigned long a3, unsigned long a4, + unsigned long a5) { __HYPERCALL_DECLS; __HYPERCALL_5ARG(a1, a2, a3, a4, a5); - stac(); asm volatile(CALL_NOSPEC : __HYPERCALL_5PARAM : [thunk_target] "a" (&hypercall_page[call]) : __HYPERCALL_CLOBBER5); - clac(); return (long)__res; } +static inline long +privcmd_call(unsigned int call, + unsigned long a1, unsigned long a2, + unsigned long a3, unsigned long a4, + unsigned long a5) +{ + long res; + + stac(); + res = xen_single_call(call, a1, a2, a3, a4, a5); + clac(); + + return res; +} + static inline int HYPERVISOR_set_trap_table(struct trap_info *table) { diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c index dc502ca8263e..2bce7958ce8b 100644 --- a/arch/x86/xen/multicalls.c +++ b/arch/x86/xen/multicalls.c @@ -80,9 +80,9 @@ void xen_mc_flush(void) and just do the call directly. */ mc = &b->entries[0]; - mc->result = privcmd_call(mc->op, - mc->args[0], mc->args[1], mc->args[2], - mc->args[3], mc->args[4]); + mc->result = xen_single_call(mc->op, mc->args[0], mc->args[1], + mc->args[2], mc->args[3], + mc->args[4]); ret = mc->result < 0; break; -- 2.13.7