[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/livepatch: fix livepatch tests
commit 902377b690f42ddf44ae91c4b0751d597f1cd694 Author: Roger Pau Monne <roger.pau@xxxxxxxxxx> AuthorDate: Tue Nov 28 18:41:31 2023 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Nov 29 10:46:42 2023 +0000 xen/livepatch: fix livepatch tests The current set of in-tree livepatch tests in xen/test/livepatch started failing after the constify of the payload funcs array, and the movement of the status data into a separate array. Fix the tests so they respect the constness of the funcs array and also make use of the new location of the per-func state data. Fixes: 82182ad7b46e ('livepatch: do not use .livepatch.funcs section to store internal state') Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx> --- xen/test/livepatch/xen_action_hooks.c | 12 +++++++----- xen/test/livepatch/xen_action_hooks_marker.c | 20 ++++++++++++-------- xen/test/livepatch/xen_action_hooks_noapply.c | 22 +++++++++++++--------- xen/test/livepatch/xen_action_hooks_nofunc.c | 6 +++--- xen/test/livepatch/xen_action_hooks_norevert.c | 24 ++++++++++++++---------- xen/test/livepatch/xen_prepost_hooks.c | 8 ++++---- xen/test/livepatch/xen_prepost_hooks_fail.c | 2 +- 7 files changed, 54 insertions(+), 40 deletions(-) diff --git a/xen/test/livepatch/xen_action_hooks.c b/xen/test/livepatch/xen_action_hooks.c index 39b5313027..fa0b3ab35f 100644 --- a/xen/test/livepatch/xen_action_hooks.c +++ b/xen/test/livepatch/xen_action_hooks.c @@ -26,9 +26,10 @@ static int apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - func->applied = LIVEPATCH_FUNC_APPLIED; + fstate->applied = LIVEPATCH_FUNC_APPLIED; apply_cnt++; printk(KERN_DEBUG "%s: applying: %s\n", __func__, func->name); @@ -47,9 +48,10 @@ static int revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - func->applied = LIVEPATCH_FUNC_NOT_APPLIED; + fstate->applied = LIVEPATCH_FUNC_NOT_APPLIED; revert_cnt++; printk(KERN_DEBUG "%s: reverting: %s\n", __func__, func->name); @@ -68,7 +70,7 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; printk(KERN_DEBUG "%s: reverted: %s\n", __func__, func->name); } diff --git a/xen/test/livepatch/xen_action_hooks_marker.c b/xen/test/livepatch/xen_action_hooks_marker.c index 4f807a577f..d2e22f70d1 100644 --- a/xen/test/livepatch/xen_action_hooks_marker.c +++ b/xen/test/livepatch/xen_action_hooks_marker.c @@ -23,9 +23,10 @@ static int pre_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre applied: %s\n", __func__, func->name); } @@ -42,9 +43,10 @@ static void post_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied != LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post applied: %s\n", __func__, func->name); } @@ -59,9 +61,10 @@ static int pre_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied != LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre reverted: %s\n", __func__, func->name); } @@ -78,9 +81,10 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post reverted: %s\n", __func__, func->name); } diff --git a/xen/test/livepatch/xen_action_hooks_noapply.c b/xen/test/livepatch/xen_action_hooks_noapply.c index 4c55c156a6..646a5fd2f0 100644 --- a/xen/test/livepatch/xen_action_hooks_noapply.c +++ b/xen/test/livepatch/xen_action_hooks_noapply.c @@ -25,9 +25,10 @@ static int pre_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre applied: %s\n", __func__, func->name); } @@ -44,7 +45,7 @@ static int apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; apply_cnt++; printk(KERN_DEBUG "%s: applying: %s\n", __func__, func->name); @@ -63,10 +64,11 @@ static void post_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; BUG_ON(apply_cnt != 1); - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post applied: %s\n", __func__, func->name); } @@ -81,9 +83,10 @@ static int pre_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre reverted: %s\n", __func__, func->name); } @@ -100,9 +103,10 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post reverted: %s\n", __func__, func->name); } diff --git a/xen/test/livepatch/xen_action_hooks_nofunc.c b/xen/test/livepatch/xen_action_hooks_nofunc.c index 2b4e90436f..077c4c1738 100644 --- a/xen/test/livepatch/xen_action_hooks_nofunc.c +++ b/xen/test/livepatch/xen_action_hooks_nofunc.c @@ -23,7 +23,7 @@ static int apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; apply_cnt++; printk(KERN_DEBUG "%s: applying: %s\n", __func__, func->name); @@ -42,7 +42,7 @@ static int revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; revert_cnt++; printk(KERN_DEBUG "%s: reverting: %s\n", __func__, func->name); @@ -61,7 +61,7 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; printk(KERN_DEBUG "%s: reverted: %s\n", __func__, func->name); } diff --git a/xen/test/livepatch/xen_action_hooks_norevert.c b/xen/test/livepatch/xen_action_hooks_norevert.c index ef77e72071..3e21ade6ab 100644 --- a/xen/test/livepatch/xen_action_hooks_norevert.c +++ b/xen/test/livepatch/xen_action_hooks_norevert.c @@ -25,9 +25,10 @@ static int pre_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre applied: %s\n", __func__, func->name); } @@ -44,9 +45,10 @@ static void post_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied != LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post applied: %s\n", __func__, func->name); } @@ -61,9 +63,10 @@ static int pre_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; - BUG_ON(func->applied != LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: pre reverted: %s\n", __func__, func->name); } @@ -80,7 +83,7 @@ static int revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; revert_cnt++; printk(KERN_DEBUG "%s: reverting: %s\n", __func__, func->name); @@ -99,16 +102,17 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; + struct livepatch_fstate *fstate = &payload->fstate[i]; BUG_ON(revert_cnt != 1); - BUG_ON(func->applied != LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); /* Outside of quiesce zone: MAY TRIGGER HOST CRASH/UNDEFINED BEHAVIOR */ arch_livepatch_quiesce(); common_livepatch_revert(payload); arch_livepatch_revive(); - BUG_ON(func->applied == LIVEPATCH_FUNC_APPLIED); + BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); printk(KERN_DEBUG "%s: post reverted: %s\n", __func__, func->name); } diff --git a/xen/test/livepatch/xen_prepost_hooks.c b/xen/test/livepatch/xen_prepost_hooks.c index 889377d6eb..17f5af6a19 100644 --- a/xen/test/livepatch/xen_prepost_hooks.c +++ b/xen/test/livepatch/xen_prepost_hooks.c @@ -30,7 +30,7 @@ static int pre_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; pre_apply_cnt++; printk(KERN_DEBUG "%s: applying: %s\n", __func__, func->name); @@ -49,7 +49,7 @@ static void post_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; post_apply_cnt++; printk(KERN_DEBUG "%s: applied: %s\n", __func__, func->name); @@ -66,7 +66,7 @@ static int pre_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; pre_revert_cnt++; printk(KERN_DEBUG "%s: reverting: %s\n", __func__, func->name); @@ -86,7 +86,7 @@ static void post_revert_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; post_revert_cnt++; printk(KERN_DEBUG "%s: reverted: %s\n", __func__, func->name); diff --git a/xen/test/livepatch/xen_prepost_hooks_fail.c b/xen/test/livepatch/xen_prepost_hooks_fail.c index c6feb5d32d..52fd7f642e 100644 --- a/xen/test/livepatch/xen_prepost_hooks_fail.c +++ b/xen/test/livepatch/xen_prepost_hooks_fail.c @@ -24,7 +24,7 @@ static int pre_apply_hook(livepatch_payload_t *payload) for (i = 0; i < payload->nfuncs; i++) { - struct livepatch_func *func = &payload->funcs[i]; + const struct livepatch_func *func = &payload->funcs[i]; printk(KERN_DEBUG "%s: pre applying: %s\n", __func__, func->name); } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |