diff mbox series

xen/livepatch: fix livepatch tests

Message ID 20231128174131.38642-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen/livepatch: fix livepatch tests | expand

Commit Message

Roger Pau Monné Nov. 28, 2023, 5:41 p.m. UTC
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@citrix.com>
---
I will see about getting those tests build in gitlab, in the meantime we should
take this fix in order to unblock osstest.
---
 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 ++---
 .../livepatch/xen_action_hooks_norevert.c     | 22 +++++++++++--------
 xen/test/livepatch/xen_prepost_hooks.c        |  8 +++----
 xen/test/livepatch/xen_prepost_hooks_fail.c   |  2 +-
 7 files changed, 53 insertions(+), 39 deletions(-)

Comments

Andrew Cooper Nov. 28, 2023, 5:44 p.m. UTC | #1
On 28/11/2023 5:41 pm, Roger Pau Monne wrote:
> 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@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Ross Lagerwall Nov. 29, 2023, 10:32 a.m. UTC | #2
On Tue, Nov 28, 2023 at 5:41 PM Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> 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@citrix.com>
> ---
> I will see about getting those tests build in gitlab, in the meantime we should
> take this fix in order to unblock osstest.
> ---
>  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 ++---
>  .../livepatch/xen_action_hooks_norevert.c     | 22 +++++++++++--------
>  xen/test/livepatch/xen_prepost_hooks.c        |  8 +++----
>  xen/test/livepatch/xen_prepost_hooks_fail.c   |  2 +-
>  7 files changed, 53 insertions(+), 39 deletions(-)
>
snip
> diff --git a/xen/test/livepatch/xen_action_hooks_norevert.c b/xen/test/livepatch/xen_action_hooks_norevert.c
> index ef77e720713e..1c4873f55640 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);
>      }
>
> @@ -62,8 +64,9 @@ static int pre_revert_hook(livepatch_payload_t *payload)
>      for (i = 0; i < payload->nfuncs; i++)
>      {
>          struct livepatch_func *func = &payload->funcs[i];

const here too?

With that fixed...
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Roger Pau Monné Nov. 29, 2023, 2:07 p.m. UTC | #3
On Wed, Nov 29, 2023 at 10:32:32AM +0000, Ross Lagerwall wrote:
> On Tue, Nov 28, 2023 at 5:41 PM Roger Pau Monne <roger.pau@citrix.com> wrote:
> >
> > 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@citrix.com>
> > ---
> > I will see about getting those tests build in gitlab, in the meantime we should
> > take this fix in order to unblock osstest.
> > ---
> >  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 ++---
> >  .../livepatch/xen_action_hooks_norevert.c     | 22 +++++++++++--------
> >  xen/test/livepatch/xen_prepost_hooks.c        |  8 +++----
> >  xen/test/livepatch/xen_prepost_hooks_fail.c   |  2 +-
> >  7 files changed, 53 insertions(+), 39 deletions(-)
> >
> snip
> > diff --git a/xen/test/livepatch/xen_action_hooks_norevert.c b/xen/test/livepatch/xen_action_hooks_norevert.c
> > index ef77e720713e..1c4873f55640 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);
> >      }
> >
> > @@ -62,8 +64,9 @@ static int pre_revert_hook(livepatch_payload_t *payload)
> >      for (i = 0; i < payload->nfuncs; i++)
> >      {
> >          struct livepatch_func *func = &payload->funcs[i];
> 
> const here too?
> 
> With that fixed...
> Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Oh, so that file is not even built.  Will see about getting it built.

Thanks, Roger.
diff mbox series

Patch

diff --git a/xen/test/livepatch/xen_action_hooks.c b/xen/test/livepatch/xen_action_hooks.c
index 39b531302731..fa0b3ab35f38 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 4f807a577f25..d2e22f70d1f4 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 4c55c156a621..646a5fd2f002 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 2b4e90436fce..077c4c173888 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 ef77e720713e..1c4873f55640 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);
     }
 
@@ -62,8 +64,9 @@  static int pre_revert_hook(livepatch_payload_t *payload)
     for (i = 0; i < payload->nfuncs; i++)
     {
         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 889377d6ebfd..17f5af6a1921 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 c6feb5d32dbd..52fd7f642ecb 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);
     }