From patchwork Mon Oct 23 11:34:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13432790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D6FBCDB474 for ; Mon, 23 Oct 2023 11:34:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.621385.967807 (Exim 4.92) (envelope-from ) id 1qutCc-0004vG-3G; Mon, 23 Oct 2023 11:34:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 621385.967807; Mon, 23 Oct 2023 11:34:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qutCb-0004v9-VQ; Mon, 23 Oct 2023 11:34:33 +0000 Received: by outflank-mailman (input) for mailman id 621385; Mon, 23 Oct 2023 11:34:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qutCZ-0004sU-HR for xen-devel@lists.xenproject.org; Mon, 23 Oct 2023 11:34:33 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1f8847ed-7198-11ee-98d5-6d05b1d4d9a1; Mon, 23 Oct 2023 13:34:30 +0200 (CEST) Received: from [2001:8b0:10b:5:538b:aaf9:4fe2:8340] (helo=u3832b3a9db3152.ant.amazon.com) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qutCT-00DWdg-El; Mon, 23 Oct 2023 11:34:25 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1f8847ed-7198-11ee-98d5-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Type:Date:Cc:To: From:Subject:Message-ID:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=30ljgbvJhZwe4KxzAAyUufP2XelmqWFz17/dDiD12EI=; b=LmFJaU8VWv8mYBR+PPA6oTimSA RTXYG2ormN10SYrtF17xMFeyYKyAT0ISd3quyVj97Dpbxrw0tCBzjBUo6pjNqarQivmkUEz4kyIat OFKQBBYc3T+2Ru/ztThlmhbhEiAMzcQeJxh5053hN2I9ZaV2XVmfbW5I4uDA2MsjXTgT2aAcbQkf9 fQLff0XgsfKalTfNjWtT2onrMbANrHmge1gBX/qNT+WYHbUbeTiv3EufIaRlmi3OLhI/TdMaSs9Ys E2szAmaWMg8JhYQb6WR5QShmthvTGoym3XFGpbd9iah3ef6ZY/TlOn6hoDL2Fl04upsFZ/c2QLEQJ WflilpVQ==; Message-ID: <0f6a5b8d5b3164dc58db193fa5c1ae7cd0969872.camel@infradead.org> Subject: [PATCH] x86/pv-shim: fix grant table operations for 32-bit guests From: David Woodhouse To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Date: Mon, 23 Oct 2023 12:34:24 +0100 User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html From: David Woodhouse When switching to call the shim functions from the normal handlers, the compat_grant_table_op() function was omitted, leaving it calling the real grant table operations. This leaves a 32-bit shim guest failing to set up its real grant table with the parent hypervisor. Fixes: e7db635f4428 ("x86/pv-shim: Don't modify the hypercall table") Signed-off-by: David Woodhouse Reviewed-by: Andrew Cooper --- xen/common/compat/grant_table.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c index e00bc24a34..af98eade17 100644 --- a/xen/common/compat/grant_table.c +++ b/xen/common/compat/grant_table.c @@ -63,6 +63,11 @@ int compat_grant_table_op( unsigned int i, cmd_op; XEN_GUEST_HANDLE_PARAM(void) cnt_uop; +#ifdef CONFIG_PV_SHIM + if ( unlikely(pv_shim) ) + return pv_shim_grant_table_op(cmd, uop, count); +#endif + set_xen_guest_handle(cnt_uop, NULL); cmd_op = cmd & GNTTABOP_CMD_MASK; if ( cmd_op != GNTTABOP_cache_flush )