All of lore.kernel.org
 help / color / mirror / Atom feed
From: Henry Wang <Henry.Wang@arm.com>
To: Jan Beulich <jbeulich@suse.com>, Juergen Gross <jgross@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: RE: [PATCH-for-4.17] xen: fix generated code for calling hypercall handlers
Date: Thu, 3 Nov 2022 16:50:16 +0000	[thread overview]
Message-ID: <AS8PR08MB799199CD19500B8BEDCDAC8A92389@AS8PR08MB7991.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <bc48e60a-a048-b954-eb64-53446dab9c32@suse.com>

Hi Juergen and Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Subject: Re: [PATCH-for-4.17] xen: fix generated code for calling hypercall
> handlers
> 
> On 03.11.2022 17: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@suse.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Release-acked-by: Henry Wang <Henry.Wang@arm.com>

With...

> albeit preferably with ...
> 
> > --- a/xen/scripts/gen_hypercall.awk
> > +++ b/xen/scripts/gen_hypercall.awk
> > @@ -263,7 +263,7 @@ END {
> >          printf("#define call_handlers_%s(num, ret, a1, a2, a3, a4, a5) \\\n",
> ca);
> >          printf("({ \\\n");
> >          if (need_mask)
> > -            printf("    uint64_t mask = 1ULL << num; \\\n");
> > +            printf("    uint64_t mask = (num > 63) ? 0 : 1ULL << num; \\\n");
> 
> ... "num" also properly parenthesized (this is part of a macro definition
> in the output after all). Easy enough to take care of while committing.

...Jan's comment fixed (or agreement to let the committer fix on commit).

Kind regards,
Henry

> 
> Jan

  reply	other threads:[~2022-11-03 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 16:36 [PATCH-for-4.17] xen: fix generated code for calling hypercall handlers Juergen Gross
2022-11-03 16:45 ` Jan Beulich
2022-11-03 16:50   ` Henry Wang [this message]
2022-11-04  5:01 ` Revert of the 4.17 hypercall handler changes " Andrew Cooper
2022-11-04  5:26   ` Juergen Gross
2022-11-04  7:36   ` Jan Beulich
2022-11-04 21:04   ` George Dunlap
2022-11-09 20:16   ` George Dunlap
2022-11-10  6:25     ` Juergen Gross
2022-11-10  8:09     ` Jan Beulich

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=AS8PR08MB799199CD19500B8BEDCDAC8A92389@AS8PR08MB7991.eurprd08.prod.outlook.com \
    --to=henry.wang@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --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.