Annotation of /trunk/module-init-tools/patches/modutils-2.4.27-no-nested-function.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1422 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1422 byte(s)
-import
1 | niro | 153 | Patch by the PaX team to get rid of executable stacks. |
2 | |||
3 | --- modutils/insmod/insmod.c | ||
4 | +++ modutils/insmod/insmod.c | ||
5 | @@ -366,18 +366,21 @@ static void hide_special_symbols(struct | ||
6 | sym->info = ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); | ||
7 | } | ||
8 | |||
9 | +static struct obj_file *load_map_file; | ||
10 | + | ||
11 | +static int load_map_cmp(const void *a, const void *b) { | ||
12 | + struct obj_symbol **as = (struct obj_symbol **) a; | ||
13 | + struct obj_symbol **bs = (struct obj_symbol **) b; | ||
14 | + unsigned long aa = obj_symbol_final_value(load_map_file, *as); | ||
15 | + unsigned long ba = obj_symbol_final_value(load_map_file, *bs); | ||
16 | + return aa < ba ? -1 : aa > ba ? 1 : 0; | ||
17 | +} | ||
18 | + | ||
19 | static void print_load_map(struct obj_file *f) | ||
20 | { | ||
21 | struct obj_symbol *sym; | ||
22 | struct obj_symbol **all, **p; | ||
23 | struct obj_section *sec; | ||
24 | - int load_map_cmp(const void *a, const void *b) { | ||
25 | - struct obj_symbol **as = (struct obj_symbol **) a; | ||
26 | - struct obj_symbol **bs = (struct obj_symbol **) b; | ||
27 | - unsigned long aa = obj_symbol_final_value(f, *as); | ||
28 | - unsigned long ba = obj_symbol_final_value(f, *bs); | ||
29 | - return aa < ba ? -1 : aa > ba ? 1 : 0; | ||
30 | - } | ||
31 | int i, nsyms, *loaded; | ||
32 | |||
33 | /* Report on the section layout. */ | ||
34 | @@ -425,7 +428,9 @@ static void print_load_map(struct obj_fi | ||
35 | *p++ = sym; | ||
36 | |||
37 | /* Sort them by final value. */ | ||
38 | + load_map_file = f; | ||
39 | qsort(all, nsyms, sizeof(struct obj_file *), load_map_cmp); | ||
40 | + load_map_file = NULL; | ||
41 | |||
42 | /* And list them. */ | ||
43 | lprintf("\nSymbols:"); |