Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE651C433E0 for ; Thu, 11 Mar 2021 07:58:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7202A64DEE for ; Thu, 11 Mar 2021 07:58:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7202A64DEE Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.96359.182203 (Exim 4.92) (envelope-from ) id 1lKGDV-0003lp-LL; Thu, 11 Mar 2021 07:58:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 96359.182203; Thu, 11 Mar 2021 07:58:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lKGDV-0003li-IV; Thu, 11 Mar 2021 07:58:45 +0000 Received: by outflank-mailman (input) for mailman id 96359; Thu, 11 Mar 2021 07:58:44 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lKGDU-0003lc-6G for xen-devel@lists.xenproject.org; Thu, 11 Mar 2021 07:58:44 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 7a6d6b2a-e0c6-45b0-a5bc-588d99917373; Thu, 11 Mar 2021 07:58:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C39A2AB8C; Thu, 11 Mar 2021 07:58:42 +0000 (UTC) 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: 7a6d6b2a-e0c6-45b0-a5bc-588d99917373 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615449522; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sM1SZv8SLDv9D8MHB1KS7Qpx2wQarvOqqTsIfJ4GZ80=; b=Pv1wMDwSOdbWiM0SKlB4lrvwhAVzlNsqHledva6ndISE+9/FDuJ4dGIwNOd6/3pHA60bb6 f/10sbfCx7Jf+ULgwC0jx706I5jRGVZDvTnPhCBxZdtImjXBJ/dRTCXSEXMa62GK8rwenW Vp+dajAndPpY0kyTEE5Qt4KsGlwbTcI= Subject: Re: [PATCH for-4.15 v2] xen/dmop: Strip __XEN_TOOLS__ header guard from public API To: Andrew Cooper Cc: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Wei Liu , Ian Jackson , Xen-devel , Paul Durrant References: <20210310150722.27194-1-andrew.cooper3@citrix.com> <13f03a67-18c2-e564-a0f6-84eccc7eeb76@citrix.com> From: Jan Beulich Message-ID: Date: Thu, 11 Mar 2021 08:58:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <13f03a67-18c2-e564-a0f6-84eccc7eeb76@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10.03.2021 18:22, Andrew Cooper wrote: > On 10/03/2021 17:12, Jan Beulich wrote: >> On 10.03.2021 16:07, Andrew Cooper wrote: >>> --- a/docs/designs/dmop.pandoc >>> +++ b/docs/designs/dmop.pandoc >>> @@ -4,9 +4,13 @@ DMOP >>> Introduction >>> ------------ >>> >>> -The aim of DMOP is to prevent a compromised device model from compromising >>> -domains other than the one it is providing emulation for (which is therefore >>> -likely already compromised). >>> +The DMOP hypercall has a new ABI design to solve problems in the Xen >>> +ecosystem. First, the ABI is fully stable, to reduce the coupling between >>> +device models and the version of Xen. >>> + >>> +Secondly, for device models in userspace, the ABI is designed specifically to >>> +allow a kernel to audit the memory ranges used, without having to know the >>> +internal structure of sub-ops. >> I appreciate the editing, but the cited points still don't justify ... >> >>> --- a/xen/include/public/hvm/dm_op.h >>> +++ b/xen/include/public/hvm/dm_op.h >>> @@ -25,9 +25,6 @@ >>> #define __XEN_PUBLIC_HVM_DM_OP_H__ >>> >>> #include "../xen.h" >>> - >>> -#if defined(__XEN__) || defined(__XEN_TOOLS__) >>> - >>> #include "../event_channel.h" >>> >>> #ifndef uint64_aligned_t >>> @@ -491,8 +488,6 @@ struct xen_dm_op { >>> } u; >>> }; >>> >>> -#endif /* __XEN__ || __XEN_TOOLS__ */ >>> - >>> struct xen_dm_op_buf { >>> XEN_GUEST_HANDLE(void) h; >>> xen_ulong_t size; >> ... this removal: What the kernel needs for its auditing (your 2nd >> point) is already outside of this guarded region, as you can see >> from the context above. You said there was a design goal of allowing >> use of this interface by (and not only through) the kernel, e.g. by >> a kernel module (which I don't think you mean to be covered by >> "device models"). If that was indeed a goal (Paul - can you confirm >> this?), this would now want listing as a 3rd item. Without such a >> statement I'd call it a bug to not have the guards there, and hence >> might either feel tempted myself to add them back at some point, or >> would ack a patch doing so. > > Xen has absolutely no business dictating stuff like this.  It is an > internal and opaque property of the domain if the hypercalls happen to > originate from logic in user mode or kernel mode.  Stubdomains would > fall into the same "kernel" category as xengt in the dom0 i915 driver. There's imo a good reason to prevent kernel to use e.g. sysctl and domctl. Those are unstable interfaces, yes, but still. > However, the actual bug I'm trying to fix with this is the need for > userspace, which doesn't link against libxc, to do > > #define __XEN_TOOLS__ > #include > > to be able to use the libxendevicemodel stable library. > > The __XEN_TOOLS__ guard is buggy even ignoring the kernel device model > aspect. Aiui to address this all that would be needed would be to move the one typedef out of the guarded region. Jan