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

[Xen-devel] [livepatch-build-tools part2 5/6] create-diff-object: Add new entries to special sections array



Handle .livepatch.hooks* and .altinstr_replacement sections as the
special sections with assigned group_size resolution function.
By default each .livepatch.hooks* sections' entry is 8 bytes long (a
pointer). The .altinstr_replacement section follows the .altinstructions
section settings.

Allow to specify different .livepatch.hooks* section entry size using
shell environment variable HOOK_STRUCT_SIZE.

Cleanup an incorrect indentation around group_size resulution functions.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
Reviewed-by: Andra-Irina Paraschiv <andraprs@xxxxxxxxxx>
Reviewed-by: Bjoern Doebel <doebel@xxxxxxxxx>
Reviewed-by: Norbert Manthey <nmanthey@xxxxxxxxx>
---
 create-diff-object.c | 87 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 33 deletions(-)

diff --git a/create-diff-object.c b/create-diff-object.c
index b0b4dcb..f6060cd 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -960,51 +960,64 @@ static void kpatch_mark_constant_labels_same(struct 
kpatch_elf *kelf)
 
 static int bug_frames_group_size(struct kpatch_elf *kelf, int offset)
 {
-    static int size = 0;
-    char *str;
-    if (!size) {
-        str = getenv("BUG_STRUCT_SIZE");
-        size = str ? atoi(str) : 8;
-    }
-
-    return size;
+       static int size = 0;
+       char *str;
+       if (!size) {
+               str = getenv("BUG_STRUCT_SIZE");
+               size = str ? atoi(str) : 8;
+       }
+
+       return size;
 }
 
 static int bug_frames_3_group_size(struct kpatch_elf *kelf, int offset)
 {
-    static int size = 0;
-    char *str;
-    if (!size) {
-        str = getenv("BUG_STRUCT_SIZE");
-        size = str ? atoi(str) : 16;
-    }
-
-    return size;
+       static int size = 0;
+       char *str;
+       if (!size) {
+               str = getenv("BUG_STRUCT_SIZE");
+               size = str ? atoi(str) : 16;
+       }
+
+       return size;
 }
 
 static int ex_table_group_size(struct kpatch_elf *kelf, int offset)
 {
-    static int size = 0;
-    char *str;
-    if (!size) {
-        str = getenv("EX_STRUCT_SIZE");
-        size = str ? atoi(str) : 8;
-    }
-
-    return size;
+       static int size = 0;
+       char *str;
+       if (!size) {
+               str = getenv("EX_STRUCT_SIZE");
+               size = str ? atoi(str) : 8;
+       }
+
+       return size;
 }
 
 static int altinstructions_group_size(struct kpatch_elf *kelf, int offset)
 {
-    static int size = 0;
-    char *str;
-    if (!size) {
-        str = getenv("ALT_STRUCT_SIZE");
-        size = str ? atoi(str) : 12;
-    }
-
-    printf("altinstr_size=%d\n", size);
-    return size;
+       static int size = 0;
+       char *str;
+       if (!size) {
+               str = getenv("ALT_STRUCT_SIZE");
+               size = str ? atoi(str) : 12;
+       }
+
+       printf("altinstr_size=%d\n", size);
+       return size;
+}
+
+static int livepatch_hooks_group_size(struct kpatch_elf *kelf, int offset)
+{
+       static int size = 0;
+       char *str;
+       if (!size) {
+               str = getenv("HOOK_STRUCT_SIZE");
+               size = str ? atoi(str) : 8;
+       }
+
+       printf("livepatch_hooks_size=%d\n", size);
+       return size;
 }
 
 /*
@@ -1084,6 +1097,14 @@ static struct special_section special_sections[] = {
                .name           = ".altinstructions",
                .group_size     = altinstructions_group_size,
        },
+       {
+               .name           = ".altinstr_replacement",
+               .group_size     = altinstructions_group_size,
+       },
+       {
+               .name           = ".livepatch.hooks",
+               .group_size     = livepatch_hooks_group_size,
+       },
        {},
 };
 
-- 
2.16.5




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



_______________________________________________
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®.