diff mbox series

[1/2] Livepatch: resolve old address before function verification

Message ID 15b092bb3af6e32f72ee8fca45317687d23b8be4.1646653825.git.doebel@amazon.de (mailing list archive)
State New, archived
Headers show
Series Livepatch: support for livepatching CET functions | expand

Commit Message

Doebel, Bjoern March 7, 2022, 11:53 a.m. UTC
When verifying that a livepatch can be applied, we may as well want to
inspect the target function to be patched. To do so, we need to resolve
this function's address before running the arch-specific
livepatch_verify hook.

Signed-off-by: Bjoern Doebel <doebel@amazon.de>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/common/livepatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ross Lagerwall March 8, 2022, 2:33 p.m. UTC | #1
> From: Bjoern Doebel <doebel@amazon.de>
> Sent: Monday, March 7, 2022 11:53 AM
> To: xen-devel@lists.xenproject.org <xen-devel@lists.xenproject.org>
> Cc: Michael Kurth <mku@amazon.de>; Martin Pohlack <mpohlack@amazon.de>; Roger Pau Monne <roger.pau@citrix.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; Bjoern Doebel <doebel@amazon.de>; Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; Ross Lagerwall <ross.lagerwall@citrix.com>
> Subject: [PATCH 1/2] Livepatch: resolve old address before function verification 
>  
> When verifying that a livepatch can be applied, we may as well want to
> inspect the target function to be patched. To do so, we need to resolve
> this function's address before running the arch-specific
> livepatch_verify hook.
> 
> Signed-off-by: Bjoern Doebel <doebel@amazon.de>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
>  xen/common/livepatch.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> index ec301a9f12..be2cf75c2d 100644
> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -684,11 +684,11 @@ static int prepare_payload(struct payload *payload,
>                  return -EINVAL;
>              }
>  
> -            rc = arch_livepatch_verify_func(f);
> +            rc = resolve_old_address(f, elf);
>              if ( rc )
>                  return rc;
>  
> -            rc = resolve_old_address(f, elf);
> +            rc = arch_livepatch_verify_func(f);
>              if ( rc )
>                  return rc;
>  
> -- 
> 2.32.0

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
diff mbox series

Patch

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index ec301a9f12..be2cf75c2d 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -684,11 +684,11 @@  static int prepare_payload(struct payload *payload,
                 return -EINVAL;
             }
 
-            rc = arch_livepatch_verify_func(f);
+            rc = resolve_old_address(f, elf);
             if ( rc )
                 return rc;
 
-            rc = resolve_old_address(f, elf);
+            rc = arch_livepatch_verify_func(f);
             if ( rc )
                 return rc;