All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ross Lagerwall <ross.lagerwall@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 4/4] x86/livepatch: perform sanity checks on the payload exception table contents
Date: Tue, 23 Apr 2024 16:31:29 +0200	[thread overview]
Message-ID: <ZifGQaO8RkveaH0Z@macbook> (raw)
In-Reply-To: <b76f105b-ac92-4759-8e93-64b97232a60c@suse.com>

On Tue, Apr 23, 2024 at 03:51:31PM +0200, Jan Beulich wrote:
> On 23.04.2024 15:12, Roger Pau Monne wrote:
> > Ensure the entries of a payload exception table only apply to text regions in
> > the payload itself.  Since the payload exception table needs to be loaded and
> > active even before a patch is applied (because hooks might already rely on it),
> > make sure the exception table (if any) only contains fixups for the payload
> > text section.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> In principle
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> Still two comments:
> 
> > --- a/xen/arch/x86/extable.c
> > +++ b/xen/arch/x86/extable.c
> > @@ -228,3 +228,21 @@ unsigned long asmlinkage search_pre_exception_table(struct cpu_user_regs *regs)
> >      }
> >      return fixup;
> >  }
> > +
> > +#ifdef CONFIG_LIVEPATCH
> > +bool extable_is_between_bounds(const struct exception_table_entry *ex_start,
> 
> s/between/in/ or even s/is_between/in/? "Between", to me at least, reads
> very much like meaning "exclusive at both ends".

Oh, OK, I don't associate any boundary inclusion with 'between' or
'in'.  The result is shorter, so I like it.

> > +                               const struct exception_table_entry *ex_end,
> > +                               const void *start, const void *end)
> > +{
> > +    for ( ; ex_start < ex_end; ex_start++ )
> > +    {
> > +        const void *addr = (void *)ex_addr(ex_start);
> > +        const void *cont = (void *)ex_cont(ex_start);
> 
> Might be nicer to use _p() here, or not do the comparisons with pointers, but
> instead with unsigned long-s.

No strong opinion regarding whether to use unsigned longs or pointers.
I've used pointers because I think the function parameters should be
pointers, and that avoided doing a cast in the comparison with
obfuscates it (or introducing yet another local variable).

I can switch to _p(), that's indeed better.

Let me know if you have a strong opinion for using unsigned longs,
otherwise my preference would be to leave it with pointers.

Thanks, Roger.


  reply	other threads:[~2024-04-23 14:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 13:12 [PATCH v3 0/4] livepatch: minor bug fixes and improvements Roger Pau Monne
2024-04-23 13:12 ` [PATCH v3 1/4] xen-livepatch: fix parameter name parsing Roger Pau Monne
2024-04-23 13:33   ` Jan Beulich
2024-04-23 14:11     ` Roger Pau Monné
2024-04-23 13:12 ` [PATCH v3 2/4] livepatch: introduce --force option Roger Pau Monne
2024-04-23 13:38   ` Jan Beulich
2024-04-23 16:05   ` Anthony PERARD
2024-04-23 13:12 ` [PATCH v3 3/4] livepatch: refuse to resolve symbols that belong to init sections Roger Pau Monne
2024-04-23 13:44   ` Jan Beulich
2024-04-23 14:26     ` Roger Pau Monné
2024-04-23 14:28       ` Jan Beulich
2024-04-23 15:03         ` Roger Pau Monné
2024-04-23 16:07           ` Jan Beulich
2024-04-23 13:12 ` [PATCH v3 4/4] x86/livepatch: perform sanity checks on the payload exception table contents Roger Pau Monne
2024-04-23 13:51   ` Jan Beulich
2024-04-23 14:31     ` Roger Pau Monné [this message]
2024-04-23 14:35       ` 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=ZifGQaO8RkveaH0Z@macbook \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=ross.lagerwall@citrix.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.