From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, konrad@kernel.org,
julien.grall@arm.com, sstabellini@kernel.org,
ross.lagerwall@citrix.com
Cc: andrew.cooper3@citrix.com, Jan Beulich <jbeulich@suse.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v3 03/18] arm/x86: change [modify, destroy]_xen_mappings to return error
Date: Sun, 11 Sep 2016 16:35:10 -0400 [thread overview]
Message-ID: <1473626125-13683-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1473626125-13683-1-git-send-email-konrad.wilk@oracle.com>
The implementation on x86 always returns zero, but
other platforms may return error values.
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Suggested-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
v2: First submission
v3: Add destroy_xen_mappings per Andrew's request.
Add Andrew's Reviewed-by.
---
xen/arch/arm/mm.c | 4 ++--
xen/arch/x86/livepatch.c | 4 +---
xen/arch/x86/mm.c | 7 ++++---
xen/include/xen/mm.h | 4 ++--
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 4e256c2..7ae9f63 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -917,9 +917,9 @@ int populate_pt_range(unsigned long virt, unsigned long mfn,
return create_xen_entries(RESERVE, virt, mfn, nr_mfns, 0);
}
-void destroy_xen_mappings(unsigned long v, unsigned long e)
+int destroy_xen_mappings(unsigned long v, unsigned long e)
{
- create_xen_entries(REMOVE, v, 0, (e - v) >> PAGE_SHIFT, 0);
+ return create_xen_entries(REMOVE, v, 0, (e - v) >> PAGE_SHIFT, 0);
}
enum mg { mg_clear, mg_ro, mg_rw, mg_rx };
diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 2f54d7b..c4d4b4d 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -224,9 +224,7 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type)
else
flag = PAGE_HYPERVISOR_RO;
- modify_xen_mappings(start, start + pages * PAGE_SIZE, flag);
-
- return 0;
+ return modify_xen_mappings(start, start + pages * PAGE_SIZE, flag);
}
void __init arch_livepatch_init(void)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b9debcc..eddf098 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5976,7 +5976,7 @@ int populate_pt_range(unsigned long virt, unsigned long mfn,
*
* It is an error to call with present flags over an unpopulated range.
*/
-void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
{
bool_t locking = system_state > SYS_STATE_boot;
l2_pgentry_t *pl2e;
@@ -6151,13 +6151,14 @@ void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
flush_area(NULL, FLUSH_TLB_GLOBAL);
#undef FLAGS_MASK
+ return 0;
}
#undef flush_area
-void destroy_xen_mappings(unsigned long s, unsigned long e)
+int destroy_xen_mappings(unsigned long s, unsigned long e)
{
- modify_xen_mappings(s, e, _PAGE_NONE);
+ return modify_xen_mappings(s, e, _PAGE_NONE);
}
void __set_fixmap(
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 58bc0b8..f470e49 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -146,8 +146,8 @@ int map_pages_to_xen(
unsigned long nr_mfns,
unsigned int flags);
/* Alter the permissions of a range of Xen virtual address space. */
-void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
-void destroy_xen_mappings(unsigned long v, unsigned long e);
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags);
+int destroy_xen_mappings(unsigned long v, unsigned long e);
/*
* Create only non-leaf page table entries for the
* page range in Xen virtual address space.
--
2.4.11
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-11 20:35 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-11 20:35 [PATCH v3] Livepatch for ARM 64 and 32 Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 01/18] arm/x86: Add HAS_[ALTERNATIVE|EX_TABLE] Konrad Rzeszutek Wilk
2016-09-12 15:28 ` Jan Beulich
2016-09-12 15:31 ` Julien Grall
2016-09-13 16:58 ` Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 02/18] livepatch: Reject payloads with .alternative or .ex_table if support is not built-in Konrad Rzeszutek Wilk
2016-09-16 12:50 ` Julien Grall
2016-09-11 20:35 ` Konrad Rzeszutek Wilk [this message]
2016-09-16 13:06 ` [PATCH v3 03/18] arm/x86: change [modify, destroy]_xen_mappings to return error Julien Grall
2016-09-11 20:35 ` [PATCH v3 04/18] arm/mm: Introduce modify_xen_mappings Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 05/18] arm: poison initmem when it is freed Konrad Rzeszutek Wilk
2016-09-16 13:31 ` Julien Grall
2016-09-11 20:35 ` [PATCH v3 06/18] livepatch: Initial ARM64 support Konrad Rzeszutek Wilk
2016-09-12 7:45 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 07/18] livepatch: ARM/x86: Check displacement of old_addr and new_addr Konrad Rzeszutek Wilk
2016-09-12 15:36 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 08/18] livepatch: ARM 32|64: Ignore mapping symbols: $[d, a, x] Konrad Rzeszutek Wilk
2016-09-12 15:52 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 09/18] livepatch/arm/x86: Check payload for for unwelcomed symbols Konrad Rzeszutek Wilk
2016-09-12 15:55 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 10/18] livepatch: Move test-cases to their own sub-directory in test Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 11/18] livepatch: tests: Move the .name value to .rodata Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 12/18] livepatch: tests: Make them compile under ARM64 Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 13/18] livepatch: x86, ARM, alternative: Expose FEATURE_LIVEPATCH Konrad Rzeszutek Wilk
2016-09-13 9:14 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 14/18] xen/arm32: Add an helper to invalidate all instruction caches Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 15/18] bug/x86/arm: Align bug_frames sections Konrad Rzeszutek Wilk
2016-09-13 9:21 ` Jan Beulich
2016-09-13 19:26 ` Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 16/18] livepatch: ARM32 support Konrad Rzeszutek Wilk
2016-09-12 7:48 ` Jan Beulich
2016-09-11 20:35 ` [PATCH v3 17/18] livepatch, arm[32|64]: Share arch_livepatch_revert_jmp Konrad Rzeszutek Wilk
2016-09-11 20:35 ` [PATCH v3 18/18] livepatch: arm[32, 64], x86: NOP test-case Konrad Rzeszutek Wilk
2016-09-16 13:35 ` [PATCH v3] Livepatch for ARM 64 and 32 Julien Grall
2016-09-16 13:41 ` Konrad Rzeszutek Wilk
2016-09-16 13:45 ` Julien Grall
2016-09-16 14:35 ` Konrad Rzeszutek Wilk
2016-09-16 14:43 ` 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=1473626125-13683-4-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad@kernel.org \
--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).