All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: andrew.cooper3@citrix.com, xen-devel@lists.xenproject.org,
	ross.lagerwall@citrix.com
Subject: Re: [PATCH v5 3/4] livepatch: NOP if func->new_addr is zero.
Date: Mon, 12 Sep 2016 02:04:54 -0600	[thread overview]
Message-ID: <57D67DC6020000780010DE46@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1473608912-5913-4-git-send-email-konrad.wilk@oracle.com>

>>> On 11.09.16 at 17:48, <konrad.wilk@oracle.com> wrote:
> The NOP functionality will NOP any of the code at
> the 'old_addr' or at 'name' if the 'new_addr' is zero.
> The purpose of this is to NOP out calls, such as:
> 
>  e8 <4-bytes-offset>
> 
> (5 byte insn), or on ARM a 4 byte insn for branching.
> 
> We need the EIP of where we need to the NOP, and that can
> be provided via the `old_addr` or `name`.
> 
> If the `old_addr` is provided we will NOP 'new_size'
> amount of bytes at that location.
> 
> The amount is up to 31 instructions if desired (which is
> the size of the opaque member). If there is a need to NOP
> more then either more 'struct livepatch_func' structures need
> to be present or we have to implement a variable size buffer.

Actually I meanwhile realized that if we wanted to void more than
this many, it would probably be better to simply make the first bytes
an unconditional branch skipping the to be disabled code (of course
provided there are no branch targets in the middle).

> --- a/xen/include/xen/livepatch.h
> +++ b/xen/include/xen/livepatch.h
> @@ -66,7 +66,16 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type types
>  void arch_livepatch_init(void);
>  
>  #include <public/sysctl.h> /* For struct livepatch_func. */
> +#include <asm/livepatch.h> /* For PATCH_INSN_SIZE. */
>  int arch_livepatch_verify_func(const struct livepatch_func *func);
> +
> +static inline size_t arch_livepatch_insn_len(const struct livepatch_func *func)

This being defined (rather than just declared) here makes me question
the arch_ prefix.

> +{
> +    if ( !func->new_addr )
> +        return func->new_size;
> +
> +    return PATCH_INSN_SIZE;

This, otoh, now might better be ARCH_PATCH_INSN_SIZE.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-09-12  8:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11 15:48 [PATCH v5] Livepatch fixes and general features for Xen 4.8 Konrad Rzeszutek Wilk
2016-09-11 15:48 ` [PATCH v5 1/4] livepatch/docs: Document .bss not being cleared, and .data potentially having changed values Konrad Rzeszutek Wilk
2016-09-12  7:49   ` Jan Beulich
2016-09-13 15:59     ` Konrad Rzeszutek Wilk
2016-09-13 16:12       ` Jan Beulich
2016-09-11 15:48 ` [PATCH v5 2/4] livepatch: Add limit of 2MB to payload .bss sections Konrad Rzeszutek Wilk
2016-09-12  7:56   ` Jan Beulich
2016-09-13 16:04   ` Ross Lagerwall
2016-09-11 15:48 ` [PATCH v5 3/4] livepatch: NOP if func->new_addr is zero Konrad Rzeszutek Wilk
2016-09-12  8:04   ` Jan Beulich [this message]
2016-09-11 15:48 ` [PATCH v5 4/4] livepach: Add .livepatch.hooks functions and test-case Konrad Rzeszutek Wilk

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=57D67DC6020000780010DE46@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=konrad.wilk@oracle.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.