diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2007-10-19 02:41:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:54 -0400 |
commit | 8256e47cdc8923e9959eb1d7f95d80da538add80 (patch) | |
tree | 4702aa3ad7c9025f70314f1146e551b4e1dfcbb2 /kernel/module.c | |
parent | 09cadedbdc01f1a4bea1f427d4fb4642eaa19da9 (diff) |
Linux Kernel Markers
The marker activation functions sits in kernel/marker.c. A hash table is used
to keep track of the registered probes and armed markers, so the markers
within a newly loaded module that should be active can be activated at module
load time.
marker_query has been removed. marker_get_first, marker_get_next and
marker_release should be used as iterators on the markers.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Acked-by: "Frank Ch. Eigler" <fche@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mike Mason <mmlnx@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 7734595bd329..3202c9950073 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1673,6 +1673,8 @@ static struct module *load_module(void __user *umod, | |||
1673 | unsigned int unusedcrcindex; | 1673 | unsigned int unusedcrcindex; |
1674 | unsigned int unusedgplindex; | 1674 | unsigned int unusedgplindex; |
1675 | unsigned int unusedgplcrcindex; | 1675 | unsigned int unusedgplcrcindex; |
1676 | unsigned int markersindex; | ||
1677 | unsigned int markersstringsindex; | ||
1676 | struct module *mod; | 1678 | struct module *mod; |
1677 | long err = 0; | 1679 | long err = 0; |
1678 | void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ | 1680 | void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ |
@@ -1939,6 +1941,9 @@ static struct module *load_module(void __user *umod, | |||
1939 | add_taint_module(mod, TAINT_FORCED_MODULE); | 1941 | add_taint_module(mod, TAINT_FORCED_MODULE); |
1940 | } | 1942 | } |
1941 | #endif | 1943 | #endif |
1944 | markersindex = find_sec(hdr, sechdrs, secstrings, "__markers"); | ||
1945 | markersstringsindex = find_sec(hdr, sechdrs, secstrings, | ||
1946 | "__markers_strings"); | ||
1942 | 1947 | ||
1943 | /* Now do relocations. */ | 1948 | /* Now do relocations. */ |
1944 | for (i = 1; i < hdr->e_shnum; i++) { | 1949 | for (i = 1; i < hdr->e_shnum; i++) { |
@@ -1961,6 +1966,11 @@ static struct module *load_module(void __user *umod, | |||
1961 | if (err < 0) | 1966 | if (err < 0) |
1962 | goto cleanup; | 1967 | goto cleanup; |
1963 | } | 1968 | } |
1969 | #ifdef CONFIG_MARKERS | ||
1970 | mod->markers = (void *)sechdrs[markersindex].sh_addr; | ||
1971 | mod->num_markers = | ||
1972 | sechdrs[markersindex].sh_size / sizeof(*mod->markers); | ||
1973 | #endif | ||
1964 | 1974 | ||
1965 | /* Find duplicate symbols */ | 1975 | /* Find duplicate symbols */ |
1966 | err = verify_export_symbols(mod); | 1976 | err = verify_export_symbols(mod); |
@@ -1979,6 +1989,11 @@ static struct module *load_module(void __user *umod, | |||
1979 | 1989 | ||
1980 | add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); | 1990 | add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); |
1981 | 1991 | ||
1992 | #ifdef CONFIG_MARKERS | ||
1993 | if (!mod->taints) | ||
1994 | marker_update_probe_range(mod->markers, | ||
1995 | mod->markers + mod->num_markers, NULL, NULL); | ||
1996 | #endif | ||
1982 | err = module_finalize(hdr, sechdrs, mod); | 1997 | err = module_finalize(hdr, sechdrs, mod); |
1983 | if (err < 0) | 1998 | if (err < 0) |
1984 | goto cleanup; | 1999 | goto cleanup; |
@@ -2570,3 +2585,18 @@ EXPORT_SYMBOL(module_remove_driver); | |||
2570 | void struct_module(struct module *mod) { return; } | 2585 | void struct_module(struct module *mod) { return; } |
2571 | EXPORT_SYMBOL(struct_module); | 2586 | EXPORT_SYMBOL(struct_module); |
2572 | #endif | 2587 | #endif |
2588 | |||
2589 | #ifdef CONFIG_MARKERS | ||
2590 | void module_update_markers(struct module *probe_module, int *refcount) | ||
2591 | { | ||
2592 | struct module *mod; | ||
2593 | |||
2594 | mutex_lock(&module_mutex); | ||
2595 | list_for_each_entry(mod, &modules, list) | ||
2596 | if (!mod->taints) | ||
2597 | marker_update_probe_range(mod->markers, | ||
2598 | mod->markers + mod->num_markers, | ||
2599 | probe_module, refcount); | ||
2600 | mutex_unlock(&module_mutex); | ||
2601 | } | ||
2602 | #endif | ||