diff options
| author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-08-30 06:00:33 +0000 |
|---|---|---|
| committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-08-30 06:00:33 +0000 |
| commit | 759515c26a8aa034b9c3f4b6dfd3b187df48883c (patch) | |
| tree | a0262e3557d083a8f287a66eaf3497319a0ef3d2 /modutils | |
| parent | 29a05f56d579e6845db6b90cab4acff47ab0dd22 (diff) | |
| download | busybox-w32-759515c26a8aa034b9c3f4b6dfd3b187df48883c.tar.gz busybox-w32-759515c26a8aa034b9c3f4b6dfd3b187df48883c.tar.bz2 busybox-w32-759515c26a8aa034b9c3f4b6dfd3b187df48883c.zip | |
handle GPLONLY symbols
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index c5cab1997..4676b5aa8 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -253,7 +253,7 @@ | |||
| 253 | #ifndef MODUTILS_MODULE_H | 253 | #ifndef MODUTILS_MODULE_H |
| 254 | static const int MODUTILS_MODULE_H = 1; | 254 | static const int MODUTILS_MODULE_H = 1; |
| 255 | 255 | ||
| 256 | #ident "$Id: insmod.c,v 1.100 2003/08/13 19:56:33 andersen Exp $" | 256 | #ident "$Id: insmod.c,v 1.101 2003/08/30 06:00:33 bug1 Exp $" |
| 257 | 257 | ||
| 258 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 258 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
| 259 | We do not use the kernel headers directly because we do not wish | 259 | We do not use the kernel headers directly because we do not wish |
| @@ -474,7 +474,7 @@ int delete_module(const char *); | |||
| 474 | #ifndef MODUTILS_OBJ_H | 474 | #ifndef MODUTILS_OBJ_H |
| 475 | static const int MODUTILS_OBJ_H = 1; | 475 | static const int MODUTILS_OBJ_H = 1; |
| 476 | 476 | ||
| 477 | #ident "$Id: insmod.c,v 1.100 2003/08/13 19:56:33 andersen Exp $" | 477 | #ident "$Id: insmod.c,v 1.101 2003/08/30 06:00:33 bug1 Exp $" |
| 478 | 478 | ||
| 479 | /* The relocatable object is manipulated using elfin types. */ | 479 | /* The relocatable object is manipulated using elfin types. */ |
| 480 | 480 | ||
| @@ -650,6 +650,8 @@ static enum obj_reloc arch_apply_relocation (struct obj_file *f, | |||
| 650 | 650 | ||
| 651 | static void arch_create_got (struct obj_file *f); | 651 | static void arch_create_got (struct obj_file *f); |
| 652 | 652 | ||
| 653 | static int obj_gpl_license(struct obj_file *f, const char **license); | ||
| 654 | |||
| 653 | #ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE | 655 | #ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE |
| 654 | static int arch_init_module (struct obj_file *f, struct new_module *); | 656 | static int arch_init_module (struct obj_file *f, struct new_module *); |
| 655 | #endif | 657 | #endif |
| @@ -660,7 +662,6 @@ static int arch_init_module (struct obj_file *f, struct new_module *); | |||
| 660 | //---------------------------------------------------------------------------- | 662 | //---------------------------------------------------------------------------- |
| 661 | 663 | ||
| 662 | 664 | ||
| 663 | |||
| 664 | /* SPFX is always a string, so it can be concatenated to string constants. */ | 665 | /* SPFX is always a string, so it can be concatenated to string constants. */ |
| 665 | #ifdef SYMBOL_PREFIX | 666 | #ifdef SYMBOL_PREFIX |
| 666 | #define SPFX SYMBOL_PREFIX | 667 | #define SPFX SYMBOL_PREFIX |
| @@ -1927,11 +1928,14 @@ add_symbols_from( | |||
| 1927 | struct new_module_symbol *s; | 1928 | struct new_module_symbol *s; |
| 1928 | size_t i; | 1929 | size_t i; |
| 1929 | int used = 0; | 1930 | int used = 0; |
| 1931 | int gpl; | ||
| 1930 | #ifdef SYMBOL_PREFIX | 1932 | #ifdef SYMBOL_PREFIX |
| 1931 | char *name_buf = 0; | 1933 | char *name_buf = 0; |
| 1932 | size_t name_alloced_size = 0; | 1934 | size_t name_alloced_size = 0; |
| 1933 | #endif | 1935 | #endif |
| 1934 | 1936 | ||
| 1937 | gpl = obj_gpl_license(f, NULL) == 0; | ||
| 1938 | |||
| 1935 | for (i = 0, s = syms; i < nsyms; ++i, ++s) { | 1939 | for (i = 0, s = syms; i < nsyms; ++i, ++s) { |
| 1936 | /* Only add symbols that are already marked external. | 1940 | /* Only add symbols that are already marked external. |
| 1937 | If we override locals we may cause problems for | 1941 | If we override locals we may cause problems for |
| @@ -1940,6 +1944,19 @@ add_symbols_from( | |||
| 1940 | struct obj_symbol *sym; | 1944 | struct obj_symbol *sym; |
| 1941 | char *name = (char *)s->name; | 1945 | char *name = (char *)s->name; |
| 1942 | 1946 | ||
| 1947 | /* GPL licensed modules can use symbols exported with | ||
| 1948 | * EXPORT_SYMBOL_GPL, so ignore any GPLONLY_ prefix on the | ||
| 1949 | * exported names. Non-GPL modules never see any GPLONLY_ | ||
| 1950 | * symbols so they cannot fudge it by adding the prefix on | ||
| 1951 | * their references. | ||
| 1952 | */ | ||
| 1953 | if (strncmp((char *)s->name, "GPLONLY_", 8) == 0) { | ||
| 1954 | if (gpl) | ||
| 1955 | ((char *)s->name) += 8; | ||
| 1956 | else | ||
| 1957 | continue; | ||
| 1958 | } | ||
| 1959 | |||
| 1943 | #ifdef SYMBOL_PREFIX | 1960 | #ifdef SYMBOL_PREFIX |
| 1944 | /* Prepend SYMBOL_PREFIX to the symbol's name (the | 1961 | /* Prepend SYMBOL_PREFIX to the symbol's name (the |
| 1945 | kernel exports `C names', but module object files | 1962 | kernel exports `C names', but module object files |
| @@ -3612,6 +3629,7 @@ static void hide_special_symbols(struct obj_file *f) | |||
| 3612 | ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); | 3629 | ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); |
| 3613 | } | 3630 | } |
| 3614 | 3631 | ||
| 3632 | |||
| 3615 | #ifdef CONFIG_FEATURE_CHECK_TAINTED_MODULE | 3633 | #ifdef CONFIG_FEATURE_CHECK_TAINTED_MODULE |
| 3616 | static int obj_gpl_license(struct obj_file *f, const char **license) | 3634 | static int obj_gpl_license(struct obj_file *f, const char **license) |
| 3617 | { | 3635 | { |
