x86,arm: Change arch_livepatch_quiesce() declaration.

On ARM we need an alternative VA region to poke in the
hypervisor .text data. And since this is setup during runtime
we may fail (it uses vmap so most likely error is ENOMEM).

As such this error needs to be bubbled up and also abort
the livepatching if it occurs.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
Konrad Rzeszutek Wilk committed 2016-09-09 11:48:21 -04:00
1 parent ff25f722f6
commit 8a085e9d94
4 files changed
+20 -5

No files matched your search

+2 -1
View File
@@ -7,8 +7,9 @@
#include <xen/livepatch_elf.h>
#include <xen/livepatch.h>
void arch_livepatch_quiesce(void)
int arch_livepatch_quiesce(void)
{
return -ENOSYS;
}
void arch_livepatch_revive(void)
+3 -1
View File
@@ -15,10 +15,12 @@
#define PATCH_INSN_SIZE 5
void arch_livepatch_quiesce(void)
int arch_livepatch_quiesce(void)
{
/* Disable WP to allow changes to read-only pages. */
write_cr0(read_cr0() & ~X86_CR0_WP);
return 0;
}
void arch_livepatch_revive(void)
+14 -2
View File
@@ -1004,11 +1004,17 @@ static int livepatch_list(xen_sysctl_livepatch_list_t *list)
static int apply_payload(struct payload *data)
{
unsigned int i;
int rc;
printk(XENLOG_INFO LIVEPATCH "%s: Applying %u functions\n",
data->name, data->nfuncs);
arch_livepatch_quiesce();
rc = arch_livepatch_quiesce();
if ( rc )
{
printk(XENLOG_ERR LIVEPATCH "%s: unable to quiesce!\n", data->name);
return rc;
}
for ( i = 0; i < data->nfuncs; i++ )
arch_livepatch_apply_jmp(&data->funcs[i]);
@@ -1028,10 +1034,16 @@ static int apply_payload(struct payload *data)
static int revert_payload(struct payload *data)
{
unsigned int i;
int rc;
printk(XENLOG_INFO LIVEPATCH "%s: Reverting\n", data->name);
arch_livepatch_quiesce();
rc = arch_livepatch_quiesce();
if ( rc )
{
printk(XENLOG_ERR LIVEPATCH "%s: unable to quiesce!\n", data->name);
return rc;
}
for ( i = 0; i < data->nfuncs; i++ )
arch_livepatch_revert_jmp(&data->funcs[i]);
+1 -1
View File
@@ -71,7 +71,7 @@ int arch_livepatch_verify_func(const struct livepatch_func *func);
* These functions are called around the critical region patching live code,
* for an architecture to take make appropratie global state adjustments.
*/
void arch_livepatch_quiesce(void);
int arch_livepatch_quiesce(void);
void arch_livepatch_revive(void);
void arch_livepatch_apply_jmp(struct livepatch_func *func);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.