Skip to content

Commit

Permalink
create-diff-object: support tracepoints and related sections
Browse files Browse the repository at this point in the history
Add support for the following special sections:

- __jump_table
- __tracepoints
- __tracepoints_ptrs
- __tracepoints_strings

Fixes #157.
  • Loading branch information
jpoimboe committed May 27, 2014
1 parent 698cc1c commit 92a4ca2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
14 changes: 11 additions & 3 deletions kpatch-build/create-diff-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ int smp_locks_group_size(struct section *sec, int offset) { return 4; }
int parainstructions_group_size(struct section *sec, int offset) { return 16; }
int ex_table_group_size(struct section *sec, int offset) { return 8; }
int altinstructions_group_size(struct section *sec, int offset) { return 12; }
int jump_table_group_size(struct section *sec, int offset) { return 24; }

int fixup_group_size(struct section *sec, int offset)
{
Expand Down Expand Up @@ -1035,6 +1036,10 @@ struct special_section special_sections[] = {
.name = "__ex_table",
.group_size = ex_table_group_size,
},
{
.name = "__jump_table",
.group_size = jump_table_group_size,
},
{
.name = ".altinstructions",
.group_size = altinstructions_group_size,
Expand Down Expand Up @@ -1167,11 +1172,14 @@ void kpatch_process_special_sections(struct kpatch_elf *kelf)
}

/*
* The following special section doesn't have relas which reference
* non-included symbols, so its entire rela section can be included.
* The following special sections don't have relas which reference
* non-included symbols, so their entire rela section can be included.
*/
list_for_each_entry(sec, &kelf->sections, list) {
if (strcmp(sec->name, ".altinstr_replacement"))
if (strcmp(sec->name, ".altinstr_replacement") &&
strcmp(sec->name, "__tracepoints") &&
strcmp(sec->name, "__tracepoints_ptrs") &&
strcmp(sec->name, "__tracepoints_strings"))
continue;

/* include base section */
Expand Down
13 changes: 13 additions & 0 deletions test/integration/tracepoints-section.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Index: src/kernel/timer.c
===================================================================
--- src.orig/kernel/timer.c
+++ src/kernel/timer.c
@@ -1370,6 +1370,8 @@ static void run_timer_softirq(struct sof
{
struct tvec_base *base = __this_cpu_read(tvec_bases);

+ printk("kpatch-test: testing __tracepoints section changes\n");
+
hrtimer_run_pending();

if (time_after_eq(jiffies, base->timer_jiffies))

0 comments on commit 92a4ca2

Please sign in to comment.