make "descriptor" a special static local variable

The "descriptor" static local variables and their containing __verbose
section are used for dynamic debug printks.  They should be considered
as special static local variable symbols because they have the same
requirements: they should never be correlated and they should only be
included if referenced by an included function.
This commit is contained in:
Josh Poimboeuf 2014-10-01 10:33:59 -05:00
parent b295c8686e
commit e27ffadce1
3 changed files with 39 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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