Merge pull request #395 from jpoimboe/static-local-fixes

static local variable fixes for WARN_ON_ONCE
This commit is contained in:
Seth Jennings 2014-09-03 13:23:55 -05:00
commit b790e4dc27
2 changed files with 36 additions and 8 deletions

View File

@ -867,7 +867,7 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
struct symbol *sym, *basesym;
struct section *tmpsec, *sec;
struct rela *rela;
int prefixlen;
int prefixlen, bundled, basebundled;
char *dot;
list_for_each_entry(sym, &patched->symbols, list) {
@ -942,7 +942,7 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
continue;
if (strncmp(rela->sym->name, sym->name, prefixlen))
continue;
if (basesym)
if (basesym && basesym != rela->sym)
ERROR("found two static local variables matching %s in orig %s",
sym->name, sec->name);
@ -951,19 +951,25 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base,
if (!basesym)
continue;
if (sym != sym->sec->sym)
ERROR("expected bundled section for %s", sym->name);
if (basesym != basesym->sec->sym)
ERROR("expected bundled section for %s",basesym->name);
bundled = sym == sym->sec->sym;
basebundled = basesym == basesym->sec->sym;
if (bundled != basebundled)
ERROR("bundle mismatch for symbol %s", sym->name);
if (!bundled && sym->sec->twin != basesym->sec)
ERROR("sections %s and %s aren't correlated",
sym->sec->name, basesym->sec->name);
log_debug("renaming and correlating %s to %s\n",
sym->name, basesym->name);
sym->name = strdup(basesym->name);
sym->twin = basesym;
basesym->twin = sym;
sym->sec->twin = basesym->sec;
basesym->sec->twin = sym->sec;
sym->status = basesym->status = SAME;
if (bundled) {
sym->sec->twin = basesym->sec;
basesym->sec->twin = sym->sec;
}
}
}

View File

@ -0,0 +1,22 @@
Index: src/mm/mmap.c
===================================================================
--- src.orig/mm/mmap.c
+++ src/mm/mmap.c
@@ -1493,6 +1493,7 @@ static inline int accountable_mapping(st
return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
}
+#include "kpatch-macros.h"
unsigned long mmap_region(struct file *file, unsigned long addr,
unsigned long len, vm_flags_t vm_flags, unsigned long pgoff)
{
@@ -1502,6 +1503,9 @@ unsigned long mmap_region(struct file *f
struct rb_node **rb_link, *rb_parent;
unsigned long charged = 0;
+ if (!jiffies)
+ printk("kpatch mmap foo\n");
+
/* Check against address space limit. */
if (!may_expand_vm(mm, len >> PAGE_SHIFT)) {
unsigned long nr_pages;