[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v3 05/12] livepatch: Add support for apply|revert action replacement hooks
 
- To: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
 
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
 
- Date: Thu, 19 Sep 2019 15:16:41 +0100
 
- Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ross.lagerwall@xxxxxxxxxx; spf=Pass smtp.mailfrom=ross.lagerwall@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
 
- Cc: wipawel@xxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, mpohlack@xxxxxxxxxx, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
 
- Delivery-date: Thu, 19 Sep 2019 14:17:12 +0000
 
- Ironport-sdr: WCFuxKvuBbSlzE5jJ98+/JeqHgycusOHNbEbOdQKJEq1DAjznN/blpgzgYv3XiDspufmOGfidA uk0+MuCoigLch8O1dahvl3v3b8x8FpHKY6bYBOwPt9UZcrzDFo0yDvQrWt8sHhpqgmAfDUVBwd 7/lwYdUWNU/Tx145gbDEQMC2AtQjvTynkfzUQHWiyspeXVUWBJIIEHVDpGfcrL4/91+Y95Y715 k51+0vpys+EUke+iW2t7nNR2adBR/Elwh9RwdGBB6kpX16VYaI98bqFz0ehWIIMPht9pXQRrAq rWM=
 
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
 
 
 
On 9/16/19 11:59 AM, Pawel Wieczorkiewicz wrote:
 
By default, in the quiescing zone, a hotpatch payload is applied with
 
 
s/hotpatch/livepatch/ (for all the patches)
 
apply_payload() and reverted with revert_payload() functions. Both of
the functions receive the payload struct pointer as a parameter. The
functions are also a place where standard 'load' and 'unload' module
hooks are executed.
To increase hotpatching system's agility and provide more flexiable
 
 
flexible
 
long-term hotpatch solution, allow to overwrite the default apply
and revert action functions with hook-like supplied alternatives.
The alternative functions are optional and the default functions are
used by default.
 
 
snip
 
@@ -1202,9 +1231,18 @@ static void livepatch_do_action(void)
           */
          list_for_each_entry_safe_reverse ( other, tmp, &applied_list, 
applied_list )
          {
-            other->rc = revert_payload(other);
+            if ( is_hook_enabled(other->hooks.revert.action) )
+            {
+                printk(XENLOG_INFO LIVEPATCH "%s: Calling revert action hook 
function\n", other->name);
+
+                other->rc = (*other->hooks.revert.action)(other);
+            }
+            else
+                other->rc = revert_payload(other);
+
+
 
Extra newline
 
              if ( other->rc == 0 )
-                other->state = LIVEPATCH_STATE_CHECKED;
+                revert_payload_tail(other);
              else
              {
                  rc = -EINVAL;
@@ -1214,9 +1252,17 @@ static void livepatch_do_action(void)
  
          if ( rc == 0 )
          {
-            rc = apply_payload(data);
+            if ( is_hook_enabled(data->hooks.apply.action) )
+            {
+                printk(XENLOG_INFO LIVEPATCH "%s: Calling apply action hook 
function\n", data->name);
+
+                rc = (*data->hooks.apply.action)(data);
+            }
+            else
+                rc = apply_payload(data);
+
              if ( rc == 0 )
-                data->state = LIVEPATCH_STATE_APPLIED;
+                apply_payload_tail(data);
          }
          break;
  
 
With the above minor issues addressed,
Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel 
 
    
     |