[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Revert of the 4.17 hypercall handler changes Re: [PATCH-for-4.17] xen: fix generated code for calling hypercall handlers


  • To: Juergen Gross <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Fri, 4 Nov 2022 05:01:34 +0000
  • Accept-language: en-GB, en-US
  • 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=7v4JX06bnruSnfUstudr0IiKSAjk/5gSwhWdF4I81vY=; b=W4RXbICabCEyqvgXhiInmNP7glyg9wydpdsVHQOyatjZavylYwhoGABQjPpKTdXddVQNqJu7S76SQKe7Sd28q8qxX0pdl4xq3Rbj16kLunoywJDC2TK59eGG1pGM6JK6EfXEs2T6e924BfEt4yWKu12SANiYt5cA62Pq0Xc0BMijxzcFpSGV6UXouj0gBrMOLjFWM/Us6LhfuHd3PbodFnt9pAfsucqaCMzSqJU8SMeyJ47Y/Pj0pQzXbFOUDhIW0MJAeRb9vHE4GSzn3GE/PdJzZv8Kb23rDfPeUSxHW3GUjOX4M3InP1FIr7HEMzblIyPp/seLdOW8lqUSWuYujQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ISMV8mhKGnqed0j1an0V4q0LMn6k7RSckYyYe4Y6PCqC/65/7d2o+3r/ns8y4DjNG4jmrBFWpjcTK9ZbtxipvtyZXL+sv1TemgTrKPqcmatY+7/x7efmaD/u0aRcOw0lgfS5Zo3i7aU7TT/iR/gUk89LwK2WYgrThBTQ5Z+hZ56BjAGHR9a7pZSAYFxV8btQvmQM+RoPpjI6Jx0hgxNWO+rFNx8Kah1PvVU1RcqKQAFM8ZBDxZjPKIayOEvivofmifkzydk+IhgUiNe+fSOxKgExKj8Sj97pjA6OUQfiyPnRKrJc+IhxteuY0nLSJocO07DXBqcgeEufSscOBVcFsQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>
  • Delivery-date: Fri, 04 Nov 2022 05:02:09 +0000
  • Ironport-data: A9a23:nGrDw6z4dxATpMzUnxN6t+fGxyrEfRIJ4+MujC+fZmUNrF6WrkVUn GUbX2vSMvyPYGOgc9BzO9ng9ktTv8LXmN9nQFBu+SAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTbaeYUidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+U0HUMja4mtC5AVnPawT5TcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KXxXy /gFcxczVC2K1rKcw72WCfRRtst2eaEHPKtH0p1h5RfwKK98BLrlE+DN79Ie2yosjMdTG/qYf 9AedTdkcBXHZVtIJ0sTD5U92uyvgxETcRUB8A7T+fVxvjWVlVMuuFTuGIO9ltiibMNZhEuH4 EnB+Hz0GEoyP92D0zuVtHmrg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Kc qOBA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY76JzuJHqrt9HWkCsd/BvJMgfvK4uNcAA
  • Thread-topic: Revert of the 4.17 hypercall handler changes Re: [PATCH-for-4.17] xen: fix generated code for calling hypercall handlers

On 03/11/2022 16:36, Juergen Gross wrote:
> The code generated for the call_handlers_*() macros needs to avoid
> undefined behavior when multiple handlers share the same priority.
> The issue is the hypercall number being unverified fed into the macros
> and then used to set a mask via "mask = 1ULL << <hypercall-number>".
>
> Avoid a shift amount of more than 63 by setting mask to zero in case
> the hypercall number is too large.
>
> Fixes: eca1f00d0227 ("xen: generate hypercall interface related code")
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

This is not a suitable fix.  There being a security issue is just the
tip of the iceberg. 

The changes broke the kexec_op() ABI and this is a blocking regression
vs 4.16.

In lieu of having time to do
https://gitlab.com/xen-project/xen/-/issues/93, here's the abridged list
of errors

The series claims "This is beneficial to performance and avoids
speculation issues.", c/s 8523851dbc4.

That half sentence is literally the sum total of justification given for
this being related to speculation.

The other half of the sentence claims performance.  But no performance
testing was done; the cover letter talks about one test with specifics,
but it describes a scenario where the delta was a handful of cycles
difference, as one part in multi-millions, probably billions.  There is
no plausible way that whatever raw data lead to the "<1% improvement"
claim was statistically significant.

The reason a performance improvement cannot be measured is that a big
out-of-order core can easily absorb the hit in the shadow of other
operations.   Smaller cores cannot, and I'm confident that adequate
performance testing would have demonstrated this.

Unaddressed is the code bloat from the change; relevant because it is
the negative half of the tradeoff on what is allegedly a net improvement
on a fastpath.  Actually trying to reason about the code bloat would
have highlighted why it's rather important that the logic be implemented
as a real function rather than a macro.

Also unaddressed is whether the multi-nesting even has any utility, and
if it does, what it does to the other kinds of workloads.

Unaddressed too is the impact from XSAs 398 and 407 which, as members of
the security team, you had substantially more exposure to than most.


Taking a step back from low level issues.

This series introduces a NIH domain-specific language for describing
hypercalls, but lacking in any documentation.  As an exercise to others,
time how long it takes you to get compile a hypervisor with a new
hypercall that takes e.g. one integer and one pointer parameter.  There
should be a whole lot more acks on that patch for it to be considered to
have an adequate review.

Somewhere (I can't recall where, but it's 4 in the morning so I'm not
looking for it now), a statement was made that if issues were found they
could be addressed going forwards.  But the series was committed without
any possibility for anyone to perform the testing requested of the
original submission.

There was one redeeming property of the series, and yet there was no
discussion anywhere about function pointer casts.  But given that the
premise was disputed to begin with, and the performance testing that
stood an outside chance of countering the dispute was ignored, and
/then/ that my objections were disregarded and the series committed
without calling a vote, I have to say that I'm very displeased with how
this went.

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.