[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 5/7] create-diff-object: Add support for expectations



Extend livepatch_patch_func to support a new field: expect. This new
field describes the expected data, its length and whether expectation
is enabled. The expectation's data is of opaque padding size.

By default the expectation field is zero-out and the expectation is
disabled unless explicitly specified in the patch.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
---
Changed since v1:
  * Do not bump the payload version again.

 common.h             | 11 ++++++++++-
 create-diff-object.c |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common.h b/common.h
index d8cde35..7c6fb73 100644
--- a/common.h
+++ b/common.h
@@ -115,6 +115,14 @@ struct kpatch_elf {
 };
 
 #define PATCH_INSN_SIZE 5
+#define MAX_REPLACEMENT_SIZE 31
+struct livepatch_expectation {
+       uint8_t enabled : 1;
+       uint8_t len : 5;
+       uint8_t pad : 2;
+       uint8_t data[MAX_REPLACEMENT_SIZE];
+};
+typedef struct livepatch_expectation livepatch_expectation_t;
 
 struct livepatch_patch_func {
        char *name;
@@ -123,9 +131,10 @@ struct livepatch_patch_func {
        uint32_t new_size;
        uint32_t old_size;
        uint8_t version;
-       unsigned char pad[31];
+       unsigned char pad[MAX_REPLACEMENT_SIZE];
        uint8_t applied;
        uint8_t _pad[7];
+       livepatch_expectation_t expect;
 };
 
 struct special_section {
diff --git a/create-diff-object.c b/create-diff-object.c
index d518503..e4592a6 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -2018,6 +2018,7 @@ static void livepatch_create_patches_sections(struct 
kpatch_elf *kelf,
                        memset(funcs[index].pad, 0, sizeof funcs[index].pad);
                        funcs[index].applied = 0;
                        memset(funcs[index]._pad, 0, sizeof funcs[index]._pad);
+                       memset(&funcs[index].expect, 0, sizeof 
funcs[index].expect);
 
                        /*
                         * Add a relocation that will populate
-- 
2.16.5




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.