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

Re: [PATCH] xen/kexec: return error code for unknown hypercalls


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 6 Feb 2026 19:39:50 +0100
  • 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=arcselector10001; 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=syBf/RLorpv/i9yzElRI4iOU5fZxH4MOYfIBjXEPObA=; b=oEJNWtgSxQJHxOJoYovtq44L3eJTpQL3kANvmmsSrNGUp0C27cZET/d1yIgAATVP0fbRqtOAcW/aC1uMFZRx0W8YJ1g00+rJp/WOsiKXvN9e5/LAAprnXyfeSN93bpZc2BZkei9/WHPkd+ErB7HG3FIMIYZHdHkWB8agMfYlUyIiBEXY0KqEN02Bb/IXjuL15V72R5tCwHot25VQtzWQXeoFnqzJFD6sCgObU4Qzpx6z1gcIgr11I6XuO04YBjpJfiUs8J89/sogSItDHkdZktWf0YQT8+YSnTV9nDQNPF8yXc2o7AvLbj+S9eqgBeQEAayDTFQtN3LnnQHJYf3i7g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qhmMGxBKeuYUrQtD5jXTWrhTOfqkyZ75VKSEYlHupi8sDtUy07tMQpN0DAYykPgqXBaqtqU5k/Ebb7jc6UcFmpVQFg+y/XjQu2OKFFra4aNMRdNLZpJlXiwzwBXPYzPcwBHKP2kf3C7/uM+11zFxyeeiYRsrV5L1HvE+G7TJZtmzeNvK3KroZ6QbnRtwYpfqulibDuCI73Hj2C32U07vNaFneKuxRhGpSZ4pYURgJ6RGz0Uv8LdFyrjyn7MWqIwci73uyOdacxPYfrqaSo4bXtogY3q33ZpvWTI6KpqiAM9Ug/kGqODpfH/cFc4Y0sxhei7zd2Nzqt5xgZYq7KpmcA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 06 Feb 2026 18:40:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Feb 06, 2026 at 06:35:32PM +0000, Andrew Cooper wrote:
> On 06/02/2026 6:31 pm, Roger Pau Monne wrote:
> > Currently do_kexec_op_internal() will return 0 for unknown hypercalls.  Fix
> > this by returning -EOPNOTSUPP instead.
> >
> > Fixes: d046f361dc93 ("Xen Security Modules: XSM")
> > Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> > ---
> > Arguably the error code for unsupported kexec hypercalls was already wonky
> > before the XSM addiiton, as it would return -EINVAL.  It's however way
> > worse after the XSM addition, as it returns 0.
> > ---
> >  xen/common/kexec.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/common/kexec.c b/xen/common/kexec.c
> > index 84fe8c35976e..8f52c5506d4a 100644
> > --- a/xen/common/kexec.c
> > +++ b/xen/common/kexec.c
> > @@ -1217,9 +1217,8 @@ static int do_kexec_op_internal(unsigned long op,
> >                                  XEN_GUEST_HANDLE_PARAM(void) uarg,
> >                                  bool compat)
> >  {
> > -    int ret = -EINVAL;
> > +    int ret = xsm_kexec(XSM_PRIV);
> >  
> > -    ret = xsm_kexec(XSM_PRIV);
> >      if ( ret )
> >          return ret;
> 
> Personally, I'd just have `int ret;` and leave the xsm_kexec() call as
> it was.  That leaves the slightly more normal pattern intact.

I'm fine with that as it also drops the dead -EINVAL initialization.

Thanks, Roger.



 


Rackspace

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