From patchwork Tue Jul 18 14:23:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9848501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BE6D602C8 for ; Tue, 18 Jul 2017 14:25:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ED6C26247 for ; Tue, 18 Jul 2017 14:25:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3349A2852B; Tue, 18 Jul 2017 14:25:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C113226247 for ; Tue, 18 Jul 2017 14:25:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXTPj-0002JO-Og; Tue, 18 Jul 2017 14:23:51 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXTPj-0002JG-07 for xen-devel@lists.xen.org; Tue, 18 Jul 2017 14:23:51 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id E5/0A-02175-6F91E695; Tue, 18 Jul 2017 14:23:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsXitHRDpO5Xybx Ig2WLdC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozJvzkLfvBUtF/8yNTAeJari5GTQ0LAX2LT qnusIDabgL7E7hefmEBsEQF1idMdF4HiXBzMAvuYJN7+u8ACkhAWCJE4sWE/mM0ioCrR3jsdz OYV8JRYNPU/I8RQOYnzx38yg9hCAmoS1/ovsUPUCEqcnPkErJ5ZQELi4IsXzBMYuWchSc1Ckl rAyLSKUb04tagstUjXQi+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzAUGIBgB+P BZudDjJIcTEqivKsP5EYK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuDlAYaWkGBRanpqRVpmDjAo YdISHDxKIrz5EkBp3uKCxNzizHSI1ClGXY5XE/5/YxJiycvPS5US51UAmSEAUpRRmgc3AhYhl xhlpYR5GYGOEuIpSC3KzSxBlX/FKM7BqCTMawYyhSczrwRu0yugI5iAjhD2zQE5oiQRISXVwD j5RtOy3iD+kwsTyttjj6hEqIQveMH38czRs+56p4JF42f7/d04p+SF7Z98e9lj9lvsdnzim+K 9caPyhHsB19+cm/Ui7f+NffN6eHfHuvtXn1d7mF4uOOWs3NP+5TuuPdr8lkvaLoR5D0tL0fJn /7STpv+OEjB5YCPZuH9GVv0Zj7PsMRZKkipKLMUZiYZazEXFiQDeCNKHiwIAAA== X-Env-Sender: prvs=365706581=Andrew.Cooper3@citrix.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1500387827!103396993!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27418 invoked from network); 18 Jul 2017 14:23:49 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2017 14:23:49 -0000 X-IronPort-AV: E=Sophos;i="5.40,378,1496102400"; d="scan'208";a="431918202" From: Andrew Cooper To: Xen-devel Date: Tue, 18 Jul 2017 15:23:45 +0100 Message-ID: <1500387825-18453-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich Subject: [Xen-devel] [PATCH] x86/evtchn: Restrict the ops usable in do_event_channel_op_compat() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This hypercall is unused by guests these days, but there was no prevention of usable subops. The following ops have been restricted, as there is no suitable structure in the evntchn_op union. EVTCHNOP_reset EVTCHNOP_init_control EVTCHNOP_expand_array EVTCHNOP_set_priority Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu --- xen/arch/x86/compat.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/compat.c b/xen/arch/x86/compat.c index 2d4be2e..f417cd5 100644 --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -57,7 +57,24 @@ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) if ( unlikely(copy_from_guest(&op, uop, 1) != 0) ) return -EFAULT; - return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void)); + switch ( op.cmd ) + { + case EVTCHNOP_bind_interdomain: + case EVTCHNOP_bind_virq: + case EVTCHNOP_bind_pirq: + case EVTCHNOP_close: + case EVTCHNOP_send: + case EVTCHNOP_status: + case EVTCHNOP_alloc_unbound: + case EVTCHNOP_bind_ipi: + case EVTCHNOP_bind_vcpu: + case EVTCHNOP_unmask: + return do_event_channel_op(op.cmd, + guest_handle_from_ptr(&uop.p->u, void)); + + default: + return -ENOSYS; + } } #endif