All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>
Subject: Re: [PATCH] xen/kexec: return error code for unknown hypercalls
Date: Fri, 6 Feb 2026 19:39:50 +0100	[thread overview]
Message-ID: <aYY1diy1J81MajXI@Mac.lan> (raw)
In-Reply-To: <d754b3b3-ef3f-43ee-81fd-076f50ada106@citrix.com>

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@citrix.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> > ---
> > 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.


      reply	other threads:[~2026-02-06 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 18:31 [PATCH] xen/kexec: return error code for unknown hypercalls Roger Pau Monne
2026-02-06 18:35 ` Andrew Cooper
2026-02-06 18:39   ` Roger Pau Monné [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYY1diy1J81MajXI@Mac.lan \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.