xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: julien.grall@arm.com, sstabellini@kernel.org,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 15/16] livepatch, arm[32|64]: Share arch_livepatch_revert
Date: Fri, 23 Sep 2016 12:15:32 -0400	[thread overview]
Message-ID: <20160923161532.GH25028@char.us.oracle.com> (raw)
In-Reply-To: <8ab8a703-832a-408d-57a9-f4a2a4590ebe@citrix.com>

> Same as previously, can this not be done with a simple memcpy?

Done!


From caaf99c75f28486737c21f1fc5f584b67e088f35 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Fri, 23 Sep 2016 11:25:12 -0400
Subject: [PATCH v6] livepatch, arm[32|64]: Share arch_livepatch_revert

It is exactly the same in both platforms.

No functional change.

Acked-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Julien Grall <julien.grall@arm.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>

v3: New submission.
v4: s/arch_livepatch_insn_len/livepatch_insn_len/
    s/PATCH_INSN_SIZE/ARCH_PATCH_INSN_SIZE/
v5: Added Julien's Acked-by.
    Fixed comments.
  - Rebase on top "livepatch: Drop _jmp from arch_livepatch_[apply,revert]_jmp"
  - s/_jmp//
v6:
  - Rebase on top ARM64 and ARM32 implementations which now have
    clean_and_invalidate_dcache_va_range on new_ptr.
---
 xen/arch/arm/arm32/livepatch.c | 13 +------------
 xen/arch/arm/arm64/livepatch.c | 13 +------------
 xen/arch/arm/livepatch.c       | 13 +++++++++++++
 3 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index d9a8caa..a7fd5e2 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -75,18 +75,7 @@ void arch_livepatch_apply(struct livepatch_func *func)
     clean_and_invalidate_dcache_va_range(new_ptr, sizeof (*new_ptr) * len);
 }
 
-void arch_livepatch_revert(const struct livepatch_func *func)
-{
-    uint32_t *new_ptr;
-    unsigned int len;
-
-    new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text;
-
-    len = livepatch_insn_len(func);
-    memcpy(new_ptr, func->opaque, len);
-
-    clean_and_invalidate_dcache_va_range(new_ptr, len);
-}
+/* arch_livepatch_revert shared with ARM 32/ARM 64. */
 
 int arch_livepatch_verify_elf(const struct livepatch_elf *elf)
 {
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index 558acb9..dae64f5 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -62,18 +62,7 @@ void arch_livepatch_apply(struct livepatch_func *func)
     clean_and_invalidate_dcache_va_range(new_ptr, sizeof (*new_ptr) * len);
 }
 
-void arch_livepatch_revert(const struct livepatch_func *func)
-{
-    uint32_t *new_ptr;
-    unsigned int len;
-
-    new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text;
-
-    len = livepatch_insn_len(func);
-    memcpy(new_ptr, func->opaque, len);
-
-    clean_and_invalidate_dcache_va_range(new_ptr, len);
-}
+/* arch_livepatch_revert shared with ARM 32/ARM 64. */
 
 int arch_livepatch_verify_elf(const struct livepatch_elf *elf)
 {
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index dfa285c..de95e54 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -69,6 +69,19 @@ int arch_livepatch_verify_func(const struct livepatch_func *func)
     return 0;
 }
 
+void arch_livepatch_revert(const struct livepatch_func *func)
+{
+    uint32_t *new_ptr;
+    unsigned int len;
+
+    new_ptr = func->old_addr - (void *)_start + vmap_of_xen_text;
+
+    len = livepatch_insn_len(func);
+    memcpy(new_ptr, func->opaque, len);
+
+    clean_and_invalidate_dcache_va_range(new_ptr, len);
+}
+
 void arch_livepatch_post_action(void)
 {
     /* arch_livepatch_revive has nuked the instruction cache. */
-- 
2.4.11

> 
> -- 
> Ross Lagerwall

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

  reply	other threads:[~2016-09-23 16:15 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 17:32 [PATCH v5] Livepatch for ARM 64 and 32 Konrad Rzeszutek Wilk
2016-09-21 17:32 ` [PATCH v5 01/16] arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/ Konrad Rzeszutek Wilk
2016-09-22 12:21   ` Julien Grall
2016-09-21 17:32 ` [PATCH v5 02/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE] Konrad Rzeszutek Wilk
2016-09-22 12:23   ` Julien Grall
2016-09-22 15:30   ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 03/16] livepatch: Reject payloads with .alternative or .ex_table if support is not built-in Konrad Rzeszutek Wilk
2016-09-23 12:47   ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 04/16] arm: poison initmem when it is freed Konrad Rzeszutek Wilk
2016-09-22 12:28   ` Julien Grall
2016-09-21 17:32 ` [PATCH v5 05/16] livepatch: Initial ARM64 support Konrad Rzeszutek Wilk
2016-09-22 12:49   ` Julien Grall
2016-09-23 13:38   ` Ross Lagerwall
2016-09-23 15:44     ` Konrad Rzeszutek Wilk
2016-09-27 16:42       ` Julien Grall
2016-09-21 17:32 ` [PATCH v5 06/16] livepatch: ARM/x86: Check displacement of old_addr and new_addr Konrad Rzeszutek Wilk
2016-09-22 12:55   ` Julien Grall
2016-09-23 14:36   ` Ross Lagerwall
2016-09-23 15:37     ` Konrad Rzeszutek Wilk
2016-09-23 15:59       ` Konrad Rzeszutek Wilk
2016-09-28 10:21         ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 07/16] livepatch: ARM 32|64: Ignore mapping symbols: $[d, a, x] Konrad Rzeszutek Wilk
2016-09-22 12:56   ` Julien Grall
2016-09-23 14:44   ` Ross Lagerwall
2016-09-23 16:13     ` Konrad Rzeszutek Wilk
2016-09-21 17:32 ` [PATCH v5 08/16] livepatch/arm/x86: Check payload for for unwelcomed symbols Konrad Rzeszutek Wilk
2016-09-22 13:00   ` Julien Grall
2016-09-23  1:29     ` Konrad Rzeszutek Wilk
2016-09-27  8:49       ` Ross Lagerwall
2016-09-23 14:49   ` Ross Lagerwall
2016-09-23 16:15     ` Konrad Rzeszutek Wilk
2016-09-21 17:32 ` [PATCH v5 09/16] livepatch: Move test-cases to their own sub-directory in test Konrad Rzeszutek Wilk
2016-09-22 13:01   ` Julien Grall
2016-09-23 14:51   ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 10/16] livepatch: x86, ARM, alternative: Expose FEATURE_LIVEPATCH Konrad Rzeszutek Wilk
2016-09-22 13:03   ` Julien Grall
2016-09-27  9:49   ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 11/16] livepatch: tests: Make them compile under ARM64 Konrad Rzeszutek Wilk
2016-09-22 13:10   ` Julien Grall
2016-09-22 19:26     ` Konrad Rzeszutek Wilk
2016-09-23  1:33     ` Konrad Rzeszutek Wilk
2016-09-23  9:50       ` Julien Grall
2016-09-27  9:49       ` Ross Lagerwall
2016-09-21 17:32 ` [PATCH v5 12/16] xen/arm32: Add an helper to invalidate all instruction caches Konrad Rzeszutek Wilk
2016-09-22 13:17   ` Julien Grall
2016-09-21 17:32 ` [PATCH v5 13/16] bug/x86/arm: Align bug_frames sections Konrad Rzeszutek Wilk
2016-09-21 17:32 ` [PATCH v5 14/16] livepatch: Initial ARM32 support Konrad Rzeszutek Wilk
2016-09-27 16:39   ` Julien Grall
2016-09-27 17:50     ` Konrad Rzeszutek Wilk
2016-09-27 23:13       ` Julien Grall
2016-09-21 17:32 ` [PATCH v5 15/16] livepatch, arm[32|64]: Share arch_livepatch_revert Konrad Rzeszutek Wilk
2016-09-23 14:59   ` Ross Lagerwall
2016-09-23 16:15     ` Konrad Rzeszutek Wilk [this message]
2016-09-21 17:32 ` [PATCH v5 16/16] livepatch: arm[32, 64], x86: NOP test-case Konrad Rzeszutek Wilk
2016-09-22 13:23   ` Julien Grall
2016-09-23  1:35     ` Konrad Rzeszutek Wilk
2016-09-23  9:53       ` Julien Grall

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=20160923161532.GH25028@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=julien.grall@arm.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=sstabellini@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).