mirror of
https://github.com/dynup/kpatch
synced 2024-12-25 06:42:05 +00:00
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:
parent
b295c8686e
commit
e27ffadce1
@ -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;
|
||||
|
||||
|
21
test/integration/gcc-static-local-var-4.patch
Normal file
21
test/integration/gcc-static-local-var-4.patch
Normal 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);
|
||||
|
7
test/integration/gcc-static-local-var-4.test
Executable file
7
test/integration/gcc-static-local-var-4.test
Executable 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
|
Loading…
Reference in New Issue
Block a user