From nobody Fri Sep 20 22:16:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1643706190; cv=none; d=zohomail.com; s=zohoarc; b=DcsQmc5LiyvSzQRcsLfkkdPJpXpEwWJ8ByS0NjLIBfBLsFL75pQvABgf2G82JheOkkaf7mtSvWxLi88JAz3EjL6fZPNvhfq9FimHnmToDlySp+C78XuL63OUHlTn65TwnVzerzpK04MOiqY8ZnfiaSHK2jDYM5j1pbSYHvyyKAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643706190; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=m5vs36ER6Ri+BF1FUM6MMCWIEyXsaWVxNJYgwdpcovk=; b=UfGcDI+vx6ju2N3aWH3LhidBqoCUVMXAOuspFc3AL8Rd7cC8xemz9KdWnYg29OwNOotbTDk2l4HkR0sXZzPMZW4aGK2JZVgRDkfn62k6LWZ5wBfhhTuogmdfYA1uUB/DcW+NCW70WiefRZFJwZMSP6rrPKrnFRDn3sJ9XAG6jX0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1643706188492100.48369069569958; Tue, 1 Feb 2022 01:03:08 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.263453.456144 (Exim 4.92) (envelope-from ) id 1nEp3k-0002Vb-NO; Tue, 01 Feb 2022 09:02:44 +0000 Received: by outflank-mailman (output) from mailman id 263453.456144; Tue, 01 Feb 2022 09:02:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEp3k-0002VU-Io; Tue, 01 Feb 2022 09:02:44 +0000 Received: by outflank-mailman (input) for mailman id 263453; Tue, 01 Feb 2022 09:02:43 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nEp3j-0002VL-Kp for xen-devel@lists.xenproject.org; Tue, 01 Feb 2022 09:02:43 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b68a112c-833d-11ec-8f75-fffcc8bd4f1a; Tue, 01 Feb 2022 10:02:42 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id ACFFE1F383; Tue, 1 Feb 2022 09:02:41 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7239513D18; Tue, 1 Feb 2022 09:02:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LFiBGjH3+GGDYwAAMHmgww (envelope-from ); Tue, 01 Feb 2022 09:02:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b68a112c-833d-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643706161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=m5vs36ER6Ri+BF1FUM6MMCWIEyXsaWVxNJYgwdpcovk=; b=k5swS/JBANgnOCvLSvxcZcxheBngpIq38q2sYUkfT3NDGG1zCZM4MDHslygdI0opsUv7xN a2IGscq+08Ssk8ksjdpOTDV+oy9JKfTVP30oZYq2rWVrEd1D40+vYoPkhKpQLbFzSR5V4v 9Kpdm5/psKL69xOS8EWNL2BwQoOPEqg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH] xen: add option to disable GNTTABOP_transfer Date: Tue, 1 Feb 2022 10:02:39 +0100 Message-Id: <20220201090239.32067-1-jgross@suse.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1643706191590100001 Content-Type: text/plain; charset="utf-8" The grant table operation GNTTABOP_transfer is meant to be used in PV device backends, and it hasn't been used in Linux since the old Xen-o-Linux days. Add a command line sub-option to the "gnttab" option for disabling the GNTTABOP_transfer functionality. Signed-off-by: Juergen Gross --- docs/misc/xen-command-line.pandoc | 7 +++++-- xen/common/grant_table.c | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 6b3da6ddc1..97ddcfa523 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1167,9 +1167,9 @@ does not provide `VM_ENTRY_LOAD_GUEST_PAT`. Specify which console gdbstub should use. See **console**. =20 ### gnttab -> `=3D List of [ max-ver:, transitive=3D ]` +> `=3D List of [ max-ver:, transitive=3D, transfer=3D= ]` =20 -> Default: `gnttab=3Dmax-ver:2,transitive` +> Default: `gnttab=3Dmax-ver:2,transitive,transfer` =20 Control various aspects of the grant table behaviour available to guests. =20 @@ -1178,6 +1178,9 @@ version are 1 and 2. * `transitive` Permit or disallow the use of transitive grants. Note that= the use of grant table v2 without transitive grants is an ABI breakage from the guests point of view. +* `transfer` Permit or disallow the GNTTABOP_transfer operation of the +grant table hypercall. Note that disallowing GNTTABOP_transfer is an ABI +breakage from the guests point of view. =20 The usage of gnttab v2 is not security supported on ARM platforms. =20 diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index ed1e2fabce..d1c225e927 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -181,6 +181,7 @@ static int parse_gnttab_max_maptrack_frames(const char = *arg) =20 unsigned int __read_mostly opt_gnttab_max_version =3D GNTTAB_MAX_VERSION; static bool __read_mostly opt_transitive_grants =3D true; +static bool __read_mostly opt_grant_transfer =3D true; =20 static int __init parse_gnttab(const char *s) { @@ -204,6 +205,8 @@ static int __init parse_gnttab(const char *s) } else if ( (val =3D parse_boolean("transitive", s, ss)) >=3D 0 ) opt_transitive_grants =3D val; + else if ( (val =3D parse_boolean("transfer", s, ss)) >=3D 0 ) + opt_grant_transfer =3D val; else rc =3D -EINVAL; =20 @@ -2233,6 +2236,9 @@ gnttab_transfer( unsigned int max_bitsize; struct active_grant_entry *act; =20 + if ( !opt_grant_transfer ) + return -ENOSYS; + for ( i =3D 0; i < count; i++ ) { bool_t okay; --=20 2.34.1