[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] domain: expose newly introduced hypercalls as XENFEAT
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 16 Oct 2023 15:00:35 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jC1Wjo2d68yWt7bQUv6t5zGkTBJiO/L4u+7ynfEWJ4U=; b=jB/GNiMlxUR/1pM9gqs8ufb6rutE2rO3d/ujJALJ8N2E+XUQy9XZ44ExdCWlBl80w+iZ/Es0wGEt7aqrD6jxjvMMhgTsVjFbvNIuIOzezPZI+Pxx7zgS3QV1y8xWuqZi5JHsM+SkaCB+BRNc1jNBQAxWilRd9lz/jff2cXlmdMWCO/lpGklOh+OgeOPJvxo9Md0R8e1F3QYvJn2HAlVRsH38BJwFq9BMPVjkf1fWfcUCAwmunQOvM2R/es1gvr8sd976jivPWNoa1NG9dxwjQrxUrbB3z9A2lK8XjDy5SVJ9vD+yAnoV3R2npU6atzVgu5PN9kQEE2iZhLAz6XergA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/LL2a9aHgdBSUo97KdAM8Pigh4VYbl09r9P63o8mQinUP+8YfJqoCJir7zhEeAfp/zxpEFwffuAOaSn2r5+KtbnjpGCaSAzk2gs6rX09wIXn0WALPEfAtYgYslQO65erq4DlD7B7yemnXos/fEITcF9oVNPSJ2bDduE22morbXBvzDfXEZySHvM09ZPjwMHqdn9U13PteXNkqQLkQUM9GxTdWCnyu0COrDJ14kZd4lkzXoIVlJK1Xx/CZaAsAT+khBThvnGKOi+ImI05dPeiZLZcIsz+lf/1tYf13PHUOA55hDNHNy1NmogRXsvMZjGywJYD/NsBmLmCGxLtg9XfA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Henry Wang <Henry.Wang@xxxxxxx>, Community Manager <community.manager@xxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 16 Oct 2023 13:01:09 +0000
- Ironport-data: A9a23:XTLjMq12Bg+hDHKINvbD5VZwkn2cJEfYwER7XKvMYLTBsI5bpzxSy mYYXWmFMqqCMWH9eIsnaI2w80pQucWEyYNhGVFupC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliOfQAOK6UbaYUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8teTb83uDgNyo4GlD5wRnO6gS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfKlBwr qchLTM3bkq/nsPm+JGgFOBOiZF2RCXrFNt3VnBI6xj8Vapja7aTBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxovy6PlGSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv22rSXzXuhBer+EpWx7uRk33+v3FUdUjsyV0uLj+KzlA2hDoc3x 0s8v3BGQbIJ3E6hQ8T5Xha4iGWZpRNaUN1Ve8Ua5QeX2+zr6gCWLmEeS3hKb9lOnMQxQDk30 F6VjpXsDDpmv7CPYWKQ8K+OqjG/MjRTKnUNDQcGUA8E7t/LsIw1yBXVQb5LC7Wph9f4HTXxx TGiryUkgbgXy8kR2M2T4lTvkz+q4J/TQWYd9gjRG26o8A59TIqkfJCzr0jW6+5aK4SURUXHu 2IL8/Vy98gLBJCJ0SaLEOMEGen14+7faGGEx1lyA5Mm6jKhvWa5epxd6y1/I0EvNdsYfTjuY wnYvgY5CIJvAUZGpJRfO+qZY/nGB4C6fTg5fpg4tuZzX6U=
- Ironport-hdrordr: A9a23:vKgfh6FLi6fvoCq2pLqELMeALOsnbusQ8zAXPiBKJCC9E/bo8v xG+c5w6faaslkssR0b9+xoW5PwI080l6QU3WB5B97LMDUO0FHCEGgI1/qA/9SPIUzDHu4279 YbT0B9YueAcGSTW6zBkXWF+9VL+qj5zEix792uq0uE1WtRGtldBwESMHf9LmRGADNoKLAeD5 Sm6s9Ot1ObCA8qhpTSPAhiYwDbzee77a7bXQ==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, Oct 16, 2023 at 02:35:44PM +0200, Jan Beulich wrote:
> On 06.10.2023 15:00, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -1580,6 +1580,10 @@ long do_vcpu_op(int cmd, unsigned int vcpuid,
> > XEN_GUEST_HANDLE_PARAM(void) arg)
> > {
> > struct vcpu_register_time_memory_area area;
> >
> > + rc = -ENOSYS;
> > + if ( 0 /* TODO: Dom's XENFEAT_vcpu_time_phys_area setting */ )
> > + break;
> > +
> > rc = -EFAULT;
> > if ( copy_from_guest(&area.addr.p, arg, 1) )
> > break;
> > --- a/xen/common/domain.c
> > +++ b/xen/common/domain.c
> > @@ -1998,6 +1998,10 @@ long common_vcpu_op(int cmd, struct vcpu *v,
> > XEN_GUEST_HANDLE_PARAM(void) arg)
> > {
> > struct vcpu_register_runstate_memory_area area;
> >
> > + rc = -ENOSYS;
> > + if ( 0 /* TODO: Dom's XENFEAT_runstate_phys_area setting */ )
> > + break;
> > +
> > rc = -EFAULT;
> > if ( copy_from_guest(&area.addr.p, arg, 1) )
> > break;
>
> ENOSYS is not correct here. EPERM, EACCES, or EOPNOTSUPP would all be more
> correct.
I don't think so, common_vcpu_op() default case does return -ENOSYS,
and the point of this path is to mimic the behavior of an hypervisor
that doesn't have the hypercalls implemented, hence -ENOSYS is the
correct behavior.
>
> > --- a/xen/common/kernel.c
> > +++ b/xen/common/kernel.c
> > @@ -607,7 +607,11 @@ long do_xen_version(int cmd,
> > XEN_GUEST_HANDLE_PARAM(void) arg)
> > switch ( fi.submap_idx )
> > {
> > case 0:
> > - fi.submap = (1U << XENFEAT_memory_op_vnode_supported);
> > + fi.submap = (1U << XENFEAT_memory_op_vnode_supported) |
> > +#ifdef CONFIG_X86
> > + (1U << XENFEAT_vcpu_time_phys_area) |
> > +#endif
> > + (1U << XENFEAT_runstate_phys_area);
>
> No provisions here for the "disabled for this domain" case?
TBH I'm not sure the `if ( 0` above are of much help, if we ever want
to provide toolstack overwrites for those it's fairly easy to spot the
paths that need to be patched anyway.
Thanks, Roger.
|