diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index c1c69fa..e71721b 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -534,11 +534,19 @@ char *special_static_prefix(struct symbol *sym) if (!strncmp(sym->name, "__warned.", 9)) return "__warned."; + + if (!strncmp(sym->name, "descriptor.", 11)) + return "descriptor."; } - if (sym->type == STT_SECTION && - !strncmp(sym->name, ".bss.__key.", 11)) - return ".bss.__key."; + if (sym->type == STT_SECTION) { + if (!strncmp(sym->name, ".bss.__key.", 11)) + return ".bss.__key."; + + /* __verbose section contains the descriptor variables */ + if (!strcmp(sym->name, "__verbose")) + return sym->name; + } return NULL; } @@ -941,14 +949,6 @@ void kpatch_correlate_static_local_variables(struct kpatch_elf *base, if (special_static_prefix(sym)) continue; - /* - * The static variables in the __verbose section contain - * debugging information specific to the patched object and - * shouldn't be correlated. - */ - if (!strcmp(sym->sec->name, "__verbose")) - continue; - if (!strchr(sym->name, '.')) continue; diff --git a/test/integration/gcc-static-local-var-4.patch b/test/integration/gcc-static-local-var-4.patch new file mode 100644 index 0000000..d7f0cf5 --- /dev/null +++ b/test/integration/gcc-static-local-var-4.patch @@ -0,0 +1,21 @@ +Index: src/fs/aio.c +=================================================================== +--- src.orig/fs/aio.c ++++ src/fs/aio.c +@@ -229,9 +229,16 @@ static int __init aio_setup(void) + } + __initcall(aio_setup); + ++void kpatch_aio_foo(void) ++{ ++ if (!jiffies) ++ printk("kpatch aio foo\n"); ++} ++ + static void put_aio_ring_file(struct kioctx *ctx) + { + struct file *aio_ring_file = ctx->aio_ring_file; ++ kpatch_aio_foo(); + if (aio_ring_file) { + truncate_setsize(aio_ring_file->f_inode, 0); + diff --git a/test/integration/gcc-static-local-var-4.test b/test/integration/gcc-static-local-var-4.test new file mode 100755 index 0000000..a1022ff --- /dev/null +++ b/test/integration/gcc-static-local-var-4.test @@ -0,0 +1,7 @@ +#!/bin/bash + +if $(nm kpatch-gcc-static-local-var-4.ko | grep -q free_ioctx); then + exit 1 +else + exit 0 +fi