diff options
| -rw-r--r-- | Documentation/filesystems/bfs.txt | 10 | ||||
| -rw-r--r-- | Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl | 2 | ||||
| -rw-r--r-- | Documentation/telephony/ixj.txt | 13 | ||||
| -rw-r--r-- | Documentation/video4linux/w9968cf.txt | 3 | ||||
| -rw-r--r-- | arch/blackfin/Kconfig | 4 | ||||
| -rw-r--r-- | arch/sparc64/kernel/process.c | 6 | ||||
| -rw-r--r-- | arch/sparc64/kernel/traps.c | 3 | ||||
| -rw-r--r-- | arch/xtensa/Kconfig | 4 | ||||
| -rw-r--r-- | include/linux/kmod.h | 5 | ||||
| -rw-r--r-- | include/linux/module.h | 50 | ||||
| -rw-r--r-- | init/Kconfig | 15 | ||||
| -rw-r--r-- | kernel/exec_domain.c | 2 | ||||
| -rw-r--r-- | kernel/kmod.c | 2 | ||||
| -rw-r--r-- | kernel/module.c | 336 | ||||
| -rw-r--r-- | kernel/sysctl.c | 4 | ||||
| -rw-r--r-- | lib/textsearch.c | 2 |
16 files changed, 259 insertions, 202 deletions
diff --git a/Documentation/filesystems/bfs.txt b/Documentation/filesystems/bfs.txt index ea825e178e79..78043d5a8fc3 100644 --- a/Documentation/filesystems/bfs.txt +++ b/Documentation/filesystems/bfs.txt | |||
| @@ -26,11 +26,11 @@ You can simplify mounting by just typing: | |||
| 26 | 26 | ||
| 27 | this will allocate the first available loopback device (and load loop.o | 27 | this will allocate the first available loopback device (and load loop.o |
| 28 | kernel module if necessary) automatically. If the loopback driver is not | 28 | kernel module if necessary) automatically. If the loopback driver is not |
| 29 | loaded automatically, make sure that your kernel is compiled with kmod | 29 | loaded automatically, make sure that you have compiled the module and |
| 30 | support (CONFIG_KMOD) enabled. Beware that umount will not | 30 | that modprobe is functioning. Beware that umount will not deallocate |
| 31 | deallocate /dev/loopN device if /etc/mtab file on your system is a | 31 | /dev/loopN device if /etc/mtab file on your system is a symbolic link to |
| 32 | symbolic link to /proc/mounts. You will need to do it manually using | 32 | /proc/mounts. You will need to do it manually using "-d" switch of |
| 33 | "-d" switch of losetup(8). Read losetup(8) manpage for more info. | 33 | losetup(8). Read losetup(8) manpage for more info. |
| 34 | 34 | ||
| 35 | To create the BFS image under UnixWare you need to find out first which | 35 | To create the BFS image under UnixWare you need to find out first which |
| 36 | slice contains it. The command prtvtoc(1M) is your friend: | 36 | slice contains it. The command prtvtoc(1M) is your friend: |
diff --git a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl index c4d2e3507af9..9d644f7e241e 100644 --- a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl +++ b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | <sect1><title>Device Components</title> | 42 | <sect1><title>Device Components</title> |
| 43 | !Esound/core/device.c | 43 | !Esound/core/device.c |
| 44 | </sect1> | 44 | </sect1> |
| 45 | <sect1><title>KMOD and Device File Entries</title> | 45 | <sect1><title>Module requests and Device File Entries</title> |
| 46 | !Esound/core/sound.c | 46 | !Esound/core/sound.c |
| 47 | </sect1> | 47 | </sect1> |
| 48 | <sect1><title>Memory Management Helpers</title> | 48 | <sect1><title>Memory Management Helpers</title> |
diff --git a/Documentation/telephony/ixj.txt b/Documentation/telephony/ixj.txt index 621024fd3a18..44d124005bad 100644 --- a/Documentation/telephony/ixj.txt +++ b/Documentation/telephony/ixj.txt | |||
| @@ -305,21 +305,14 @@ driver, like this: | |||
| 305 | 305 | ||
| 306 | which will result in the needed drivers getting loaded automatically. | 306 | which will result in the needed drivers getting loaded automatically. |
| 307 | 307 | ||
| 308 | g. if you are planning on using kerneld to automatically load the | 308 | g. if you are planning on having the kernel automatically request |
| 309 | module for you, then you need to edit /etc/conf.modules and add the | 309 | the module for you, then you need to edit /etc/conf.modules and add the |
| 310 | following lines: | 310 | following lines: |
| 311 | 311 | ||
| 312 | options ixj dspio=0x340 xio=0x330 ixjdebug=0 | 312 | options ixj dspio=0x340 xio=0x330 ixjdebug=0 |
| 313 | 313 | ||
| 314 | If you do this, then when you execute an application that uses the | 314 | If you do this, then when you execute an application that uses the |
| 315 | module kerneld will load the module for you. Note that to do this, | 315 | module the kernel will request that it is loaded. |
| 316 | you need to have your kernel set to support kerneld. You can check | ||
| 317 | for this by looking at /usr/src/linux/.config and you should see this: | ||
| 318 | |||
| 319 | # Loadable module support | ||
| 320 | # | ||
| 321 | <snip> | ||
| 322 | CONFIG_KMOD=y | ||
| 323 | 316 | ||
| 324 | h. if you want non-root users to be able to read and write to the | 317 | h. if you want non-root users to be able to read and write to the |
| 325 | ixj devices (this is a good idea!) you should do the following: | 318 | ixj devices (this is a good idea!) you should do the following: |
diff --git a/Documentation/video4linux/w9968cf.txt b/Documentation/video4linux/w9968cf.txt index e0bba8393c77..05138e8aea07 100644 --- a/Documentation/video4linux/w9968cf.txt +++ b/Documentation/video4linux/w9968cf.txt | |||
| @@ -193,9 +193,6 @@ Description: Automatic 'ovcamchip' module loading: 0 disabled, 1 enabled. | |||
| 193 | loads that module automatically. This action is performed as | 193 | loads that module automatically. This action is performed as |
| 194 | once soon as the 'w9968cf' module is loaded into memory. | 194 | once soon as the 'w9968cf' module is loaded into memory. |
| 195 | Default: 1 | 195 | Default: 1 |
| 196 | Note: The kernel must be compiled with the CONFIG_KMOD option | ||
| 197 | enabled for the 'ovcamchip' module to be loaded and for | ||
| 198 | this parameter to be present. | ||
| 199 | ------------------------------------------------------------------------------- | 196 | ------------------------------------------------------------------------------- |
| 200 | Name: simcams | 197 | Name: simcams |
| 201 | Type: int | 198 | Type: int |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index b87634e75f20..b83b8ef84e91 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
| @@ -873,8 +873,8 @@ config HOTPLUG | |||
| 873 | plugged into slots found on all modern laptop computers. Another | 873 | plugged into slots found on all modern laptop computers. Another |
| 874 | example, used on modern desktops as well as laptops, is USB. | 874 | example, used on modern desktops as well as laptops, is USB. |
| 875 | 875 | ||
| 876 | Enable HOTPLUG and KMOD, and build a modular kernel. Get agent | 876 | Enable HOTPLUG and build a modular kernel. Get agent software |
| 877 | software (at <http://linux-hotplug.sourceforge.net/>) and install it. | 877 | (from <http://linux-hotplug.sourceforge.net/>) and install it. |
| 878 | Then your kernel will automatically call out to a user mode "policy | 878 | Then your kernel will automatically call out to a user mode "policy |
| 879 | agent" (/sbin/hotplug) to load modules and set up software needed | 879 | agent" (/sbin/hotplug) to load modules and set up software needed |
| 880 | to use devices as you hotplug them. | 880 | to use devices as you hotplug them. |
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index c1f1ff29e979..31ea752d307b 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c | |||
| @@ -683,9 +683,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | |||
| 683 | ((unsigned long) child_sf) - STACK_BIAS; | 683 | ((unsigned long) child_sf) - STACK_BIAS; |
| 684 | 684 | ||
| 685 | /* Special case, if we are spawning a kernel thread from | 685 | /* Special case, if we are spawning a kernel thread from |
| 686 | * a userspace task (via KMOD, NFS, or similar) we must | 686 | * a userspace task (usermode helper, NFS or similar), we |
| 687 | * disable performance counters in the child because the | 687 | * must disable performance counters in the child because |
| 688 | * address space and protection realm are changing. | 688 | * the address space and protection realm are changing. |
| 689 | */ | 689 | */ |
| 690 | if (t->flags & _TIF_PERFCTR) { | 690 | if (t->flags & _TIF_PERFCTR) { |
| 691 | t->user_cntd0 = t->user_cntd1 = NULL; | 691 | t->user_cntd0 = t->user_cntd1 = NULL; |
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 0aa819c29dbc..bd30ecba5630 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
| @@ -36,9 +36,6 @@ | |||
| 36 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
| 37 | #include <asm/timer.h> | 37 | #include <asm/timer.h> |
| 38 | #include <asm/head.h> | 38 | #include <asm/head.h> |
| 39 | #ifdef CONFIG_KMOD | ||
| 40 | #include <linux/kmod.h> | ||
| 41 | #endif | ||
| 42 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
| 43 | 40 | ||
| 44 | #include "entry.h" | 41 | #include "entry.h" |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 9fc8551a1cf6..02e417d3d8e9 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
| @@ -194,8 +194,8 @@ config HOTPLUG | |||
| 194 | plugged into slots found on all modern laptop computers. Another | 194 | plugged into slots found on all modern laptop computers. Another |
| 195 | example, used on modern desktops as well as laptops, is USB. | 195 | example, used on modern desktops as well as laptops, is USB. |
| 196 | 196 | ||
| 197 | Enable HOTPLUG and KMOD, and build a modular kernel. Get agent | 197 | Enable HOTPLUG and build a modular kernel. Get agent software |
| 198 | software (at <http://linux-hotplug.sourceforge.net/>) and install it. | 198 | (from <http://linux-hotplug.sourceforge.net/>) and install it. |
| 199 | Then your kernel will automatically call out to a user mode "policy | 199 | Then your kernel will automatically call out to a user mode "policy |
| 200 | agent" (/sbin/hotplug) to load modules and set up software needed | 200 | agent" (/sbin/hotplug) to load modules and set up software needed |
| 201 | to use devices as you hotplug them. | 201 | to use devices as you hotplug them. |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5dc13848891b..0509c4ce4857 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
| @@ -25,15 +25,16 @@ | |||
| 25 | 25 | ||
| 26 | #define KMOD_PATH_LEN 256 | 26 | #define KMOD_PATH_LEN 256 |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_KMOD | 28 | #ifdef CONFIG_MODULES |
| 29 | /* modprobe exit status on success, -ve on error. Return value | 29 | /* modprobe exit status on success, -ve on error. Return value |
| 30 | * usually useless though. */ | 30 | * usually useless though. */ |
| 31 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); | 31 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); |
| 32 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
| 32 | #else | 33 | #else |
| 33 | static inline int request_module(const char * name, ...) { return -ENOSYS; } | 34 | static inline int request_module(const char * name, ...) { return -ENOSYS; } |
| 35 | #define try_then_request_module(x, mod...) (x) | ||
| 34 | #endif | 36 | #endif |
| 35 | 37 | ||
| 36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
| 37 | 38 | ||
| 38 | struct key; | 39 | struct key; |
| 39 | struct file; | 40 | struct file; |
diff --git a/include/linux/module.h b/include/linux/module.h index 3e03b1acbc94..fce15ebd0e1c 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -249,27 +249,30 @@ struct module | |||
| 249 | 249 | ||
| 250 | /* Exported symbols */ | 250 | /* Exported symbols */ |
| 251 | const struct kernel_symbol *syms; | 251 | const struct kernel_symbol *syms; |
| 252 | unsigned int num_syms; | ||
| 253 | const unsigned long *crcs; | 252 | const unsigned long *crcs; |
| 253 | unsigned int num_syms; | ||
| 254 | 254 | ||
| 255 | /* GPL-only exported symbols. */ | 255 | /* GPL-only exported symbols. */ |
| 256 | const struct kernel_symbol *gpl_syms; | ||
| 257 | unsigned int num_gpl_syms; | 256 | unsigned int num_gpl_syms; |
| 257 | const struct kernel_symbol *gpl_syms; | ||
| 258 | const unsigned long *gpl_crcs; | 258 | const unsigned long *gpl_crcs; |
| 259 | 259 | ||
| 260 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 260 | /* unused exported symbols. */ | 261 | /* unused exported symbols. */ |
| 261 | const struct kernel_symbol *unused_syms; | 262 | const struct kernel_symbol *unused_syms; |
| 262 | unsigned int num_unused_syms; | ||
| 263 | const unsigned long *unused_crcs; | 263 | const unsigned long *unused_crcs; |
| 264 | unsigned int num_unused_syms; | ||
| 265 | |||
| 264 | /* GPL-only, unused exported symbols. */ | 266 | /* GPL-only, unused exported symbols. */ |
| 265 | const struct kernel_symbol *unused_gpl_syms; | ||
| 266 | unsigned int num_unused_gpl_syms; | 267 | unsigned int num_unused_gpl_syms; |
| 268 | const struct kernel_symbol *unused_gpl_syms; | ||
| 267 | const unsigned long *unused_gpl_crcs; | 269 | const unsigned long *unused_gpl_crcs; |
| 270 | #endif | ||
| 268 | 271 | ||
| 269 | /* symbols that will be GPL-only in the near future. */ | 272 | /* symbols that will be GPL-only in the near future. */ |
| 270 | const struct kernel_symbol *gpl_future_syms; | 273 | const struct kernel_symbol *gpl_future_syms; |
| 271 | unsigned int num_gpl_future_syms; | ||
| 272 | const unsigned long *gpl_future_crcs; | 274 | const unsigned long *gpl_future_crcs; |
| 275 | unsigned int num_gpl_future_syms; | ||
| 273 | 276 | ||
| 274 | /* Exception table */ | 277 | /* Exception table */ |
| 275 | unsigned int num_exentries; | 278 | unsigned int num_exentries; |
| @@ -285,10 +288,10 @@ struct module | |||
| 285 | void *module_core; | 288 | void *module_core; |
| 286 | 289 | ||
| 287 | /* Here are the sizes of the init and core sections */ | 290 | /* Here are the sizes of the init and core sections */ |
| 288 | unsigned long init_size, core_size; | 291 | unsigned int init_size, core_size; |
| 289 | 292 | ||
| 290 | /* The size of the executable code in each section. */ | 293 | /* The size of the executable code in each section. */ |
| 291 | unsigned long init_text_size, core_text_size; | 294 | unsigned int init_text_size, core_text_size; |
| 292 | 295 | ||
| 293 | /* The handle returned from unwind_add_table. */ | 296 | /* The handle returned from unwind_add_table. */ |
| 294 | void *unwind_info; | 297 | void *unwind_info; |
| @@ -300,29 +303,15 @@ struct module | |||
| 300 | 303 | ||
| 301 | #ifdef CONFIG_GENERIC_BUG | 304 | #ifdef CONFIG_GENERIC_BUG |
| 302 | /* Support for BUG */ | 305 | /* Support for BUG */ |
| 306 | unsigned num_bugs; | ||
| 303 | struct list_head bug_list; | 307 | struct list_head bug_list; |
| 304 | struct bug_entry *bug_table; | 308 | struct bug_entry *bug_table; |
| 305 | unsigned num_bugs; | ||
| 306 | #endif | ||
| 307 | |||
| 308 | #ifdef CONFIG_MODULE_UNLOAD | ||
| 309 | /* Reference counts */ | ||
| 310 | struct module_ref ref[NR_CPUS]; | ||
| 311 | |||
| 312 | /* What modules depend on me? */ | ||
| 313 | struct list_head modules_which_use_me; | ||
| 314 | |||
| 315 | /* Who is waiting for us to be unloaded */ | ||
| 316 | struct task_struct *waiter; | ||
| 317 | |||
| 318 | /* Destruction function. */ | ||
| 319 | void (*exit)(void); | ||
| 320 | #endif | 309 | #endif |
| 321 | 310 | ||
| 322 | #ifdef CONFIG_KALLSYMS | 311 | #ifdef CONFIG_KALLSYMS |
| 323 | /* We keep the symbol and string tables for kallsyms. */ | 312 | /* We keep the symbol and string tables for kallsyms. */ |
| 324 | Elf_Sym *symtab; | 313 | Elf_Sym *symtab; |
| 325 | unsigned long num_symtab; | 314 | unsigned int num_symtab; |
| 326 | char *strtab; | 315 | char *strtab; |
| 327 | 316 | ||
| 328 | /* Section attributes */ | 317 | /* Section attributes */ |
| @@ -342,6 +331,21 @@ struct module | |||
| 342 | struct marker *markers; | 331 | struct marker *markers; |
| 343 | unsigned int num_markers; | 332 | unsigned int num_markers; |
| 344 | #endif | 333 | #endif |
| 334 | |||
| 335 | #ifdef CONFIG_MODULE_UNLOAD | ||
| 336 | /* What modules depend on me? */ | ||
| 337 | struct list_head modules_which_use_me; | ||
| 338 | |||
| 339 | /* Who is waiting for us to be unloaded */ | ||
| 340 | struct task_struct *waiter; | ||
| 341 | |||
| 342 | /* Destruction function. */ | ||
| 343 | void (*exit)(void); | ||
| 344 | |||
| 345 | /* Reference counts */ | ||
| 346 | struct module_ref ref[NR_CPUS]; | ||
| 347 | #endif | ||
| 348 | |||
| 345 | }; | 349 | }; |
| 346 | #ifndef MODULE_ARCH_INIT | 350 | #ifndef MODULE_ARCH_INIT |
| 347 | #define MODULE_ARCH_INIT {} | 351 | #define MODULE_ARCH_INIT {} |
diff --git a/init/Kconfig b/init/Kconfig index 6199d1120900..a50bdfed2df7 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -856,8 +856,8 @@ config MODULE_UNLOAD | |||
| 856 | help | 856 | help |
| 857 | Without this option you will not be able to unload any | 857 | Without this option you will not be able to unload any |
| 858 | modules (note that some modules may not be unloadable | 858 | modules (note that some modules may not be unloadable |
| 859 | anyway), which makes your kernel slightly smaller and | 859 | anyway), which makes your kernel smaller, faster |
| 860 | simpler. If unsure, say Y. | 860 | and simpler. If unsure, say Y. |
| 861 | 861 | ||
| 862 | config MODULE_FORCE_UNLOAD | 862 | config MODULE_FORCE_UNLOAD |
| 863 | bool "Forced module unloading" | 863 | bool "Forced module unloading" |
| @@ -893,16 +893,11 @@ config MODULE_SRCVERSION_ALL | |||
| 893 | will be created for all modules. If unsure, say N. | 893 | will be created for all modules. If unsure, say N. |
| 894 | 894 | ||
| 895 | config KMOD | 895 | config KMOD |
| 896 | bool "Automatic kernel module loading" | 896 | def_bool y |
| 897 | depends on MODULES | 897 | depends on MODULES |
| 898 | help | 898 | help |
| 899 | Normally when you have selected some parts of the kernel to | 899 | This is being removed soon. These days, CONFIG_MODULES |
| 900 | be created as kernel modules, you must load them (using the | 900 | implies CONFIG_KMOD, so use that instead. |
| 901 | "modprobe" command) before you can use them. If you say Y | ||
| 902 | here, some parts of the kernel will be able to load modules | ||
| 903 | automatically: when a part of the kernel needs a module, it | ||
| 904 | runs modprobe with the appropriate arguments, thereby | ||
| 905 | loading the module if it is available. If unsure, say Y. | ||
| 906 | 901 | ||
| 907 | config STOP_MACHINE | 902 | config STOP_MACHINE |
| 908 | bool | 903 | bool |
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index a9e6bad9f706..c1ef192aa655 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c | |||
| @@ -65,7 +65,7 @@ lookup_exec_domain(u_long personality) | |||
| 65 | goto out; | 65 | goto out; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | #ifdef CONFIG_KMOD | 68 | #ifdef CONFIG_MODULES |
| 69 | read_unlock(&exec_domains_lock); | 69 | read_unlock(&exec_domains_lock); |
| 70 | request_module("personality-%ld", pers); | 70 | request_module("personality-%ld", pers); |
| 71 | read_lock(&exec_domains_lock); | 71 | read_lock(&exec_domains_lock); |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 8df97d3dfda8..90d7af1c1655 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
| @@ -42,7 +42,7 @@ extern int max_threads; | |||
| 42 | 42 | ||
| 43 | static struct workqueue_struct *khelper_wq; | 43 | static struct workqueue_struct *khelper_wq; |
| 44 | 44 | ||
| 45 | #ifdef CONFIG_KMOD | 45 | #ifdef CONFIG_MODULES |
| 46 | 46 | ||
| 47 | /* | 47 | /* |
| 48 | modprobe_path is set via /proc/sys. | 48 | modprobe_path is set via /proc/sys. |
diff --git a/kernel/module.c b/kernel/module.c index 5f80478b746d..d8b5605132a0 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -70,6 +70,9 @@ static DECLARE_WAIT_QUEUE_HEAD(module_wq); | |||
| 70 | 70 | ||
| 71 | static BLOCKING_NOTIFIER_HEAD(module_notify_list); | 71 | static BLOCKING_NOTIFIER_HEAD(module_notify_list); |
| 72 | 72 | ||
| 73 | /* Bounds of module allocation, for speeding __module_text_address */ | ||
| 74 | static unsigned long module_addr_min = -1UL, module_addr_max = 0; | ||
| 75 | |||
| 73 | int register_module_notifier(struct notifier_block * nb) | 76 | int register_module_notifier(struct notifier_block * nb) |
| 74 | { | 77 | { |
| 75 | return blocking_notifier_chain_register(&module_notify_list, nb); | 78 | return blocking_notifier_chain_register(&module_notify_list, nb); |
| @@ -134,17 +137,19 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; | |||
| 134 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; | 137 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; |
| 135 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; | 138 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; |
| 136 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; | 139 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; |
| 137 | extern const struct kernel_symbol __start___ksymtab_unused[]; | ||
| 138 | extern const struct kernel_symbol __stop___ksymtab_unused[]; | ||
| 139 | extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; | ||
| 140 | extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; | ||
| 141 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; | 140 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; |
| 142 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; | 141 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; |
| 143 | extern const unsigned long __start___kcrctab[]; | 142 | extern const unsigned long __start___kcrctab[]; |
| 144 | extern const unsigned long __start___kcrctab_gpl[]; | 143 | extern const unsigned long __start___kcrctab_gpl[]; |
| 145 | extern const unsigned long __start___kcrctab_gpl_future[]; | 144 | extern const unsigned long __start___kcrctab_gpl_future[]; |
| 145 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 146 | extern const struct kernel_symbol __start___ksymtab_unused[]; | ||
| 147 | extern const struct kernel_symbol __stop___ksymtab_unused[]; | ||
| 148 | extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; | ||
| 149 | extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; | ||
| 146 | extern const unsigned long __start___kcrctab_unused[]; | 150 | extern const unsigned long __start___kcrctab_unused[]; |
| 147 | extern const unsigned long __start___kcrctab_unused_gpl[]; | 151 | extern const unsigned long __start___kcrctab_unused_gpl[]; |
| 152 | #endif | ||
| 148 | 153 | ||
| 149 | #ifndef CONFIG_MODVERSIONS | 154 | #ifndef CONFIG_MODVERSIONS |
| 150 | #define symversion(base, idx) NULL | 155 | #define symversion(base, idx) NULL |
| @@ -152,156 +157,186 @@ extern const unsigned long __start___kcrctab_unused_gpl[]; | |||
| 152 | #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL) | 157 | #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL) |
| 153 | #endif | 158 | #endif |
| 154 | 159 | ||
| 155 | /* lookup symbol in given range of kernel_symbols */ | ||
| 156 | static const struct kernel_symbol *lookup_symbol(const char *name, | ||
| 157 | const struct kernel_symbol *start, | ||
| 158 | const struct kernel_symbol *stop) | ||
| 159 | { | ||
| 160 | const struct kernel_symbol *ks = start; | ||
| 161 | for (; ks < stop; ks++) | ||
| 162 | if (strcmp(ks->name, name) == 0) | ||
| 163 | return ks; | ||
| 164 | return NULL; | ||
| 165 | } | ||
| 166 | |||
| 167 | static bool always_ok(bool gplok, bool warn, const char *name) | ||
| 168 | { | ||
| 169 | return true; | ||
| 170 | } | ||
| 171 | |||
| 172 | static bool printk_unused_warning(bool gplok, bool warn, const char *name) | ||
| 173 | { | ||
| 174 | if (warn) { | ||
| 175 | printk(KERN_WARNING "Symbol %s is marked as UNUSED, " | ||
| 176 | "however this module is using it.\n", name); | ||
| 177 | printk(KERN_WARNING | ||
| 178 | "This symbol will go away in the future.\n"); | ||
| 179 | printk(KERN_WARNING | ||
| 180 | "Please evalute if this is the right api to use and if " | ||
| 181 | "it really is, submit a report the linux kernel " | ||
| 182 | "mailinglist together with submitting your code for " | ||
| 183 | "inclusion.\n"); | ||
| 184 | } | ||
| 185 | return true; | ||
| 186 | } | ||
| 187 | |||
| 188 | static bool gpl_only_unused_warning(bool gplok, bool warn, const char *name) | ||
| 189 | { | ||
| 190 | if (!gplok) | ||
| 191 | return false; | ||
| 192 | return printk_unused_warning(gplok, warn, name); | ||
| 193 | } | ||
| 194 | |||
| 195 | static bool gpl_only(bool gplok, bool warn, const char *name) | ||
| 196 | { | ||
| 197 | return gplok; | ||
| 198 | } | ||
| 199 | |||
| 200 | static bool warn_if_not_gpl(bool gplok, bool warn, const char *name) | ||
| 201 | { | ||
| 202 | if (!gplok && warn) { | ||
| 203 | printk(KERN_WARNING "Symbol %s is being used " | ||
| 204 | "by a non-GPL module, which will not " | ||
| 205 | "be allowed in the future\n", name); | ||
| 206 | printk(KERN_WARNING "Please see the file " | ||
| 207 | "Documentation/feature-removal-schedule.txt " | ||
| 208 | "in the kernel source tree for more details.\n"); | ||
| 209 | } | ||
| 210 | return true; | ||
| 211 | } | ||
| 212 | |||
| 213 | struct symsearch { | 160 | struct symsearch { |
| 214 | const struct kernel_symbol *start, *stop; | 161 | const struct kernel_symbol *start, *stop; |
| 215 | const unsigned long *crcs; | 162 | const unsigned long *crcs; |
| 216 | bool (*check)(bool gplok, bool warn, const char *name); | 163 | enum { |
| 164 | NOT_GPL_ONLY, | ||
| 165 | GPL_ONLY, | ||
| 166 | WILL_BE_GPL_ONLY, | ||
| 167 | } licence; | ||
| 168 | bool unused; | ||
| 217 | }; | 169 | }; |
| 218 | 170 | ||
| 219 | /* Look through this array of symbol tables for a symbol match which | 171 | static bool each_symbol_in_section(const struct symsearch *arr, |
| 220 | * passes the check function. */ | 172 | unsigned int arrsize, |
| 221 | static const struct kernel_symbol *search_symarrays(const struct symsearch *arr, | 173 | struct module *owner, |
| 222 | unsigned int num, | 174 | bool (*fn)(const struct symsearch *syms, |
| 223 | const char *name, | 175 | struct module *owner, |
| 224 | bool gplok, | 176 | unsigned int symnum, void *data), |
| 225 | bool warn, | 177 | void *data) |
| 226 | const unsigned long **crc) | ||
| 227 | { | 178 | { |
| 228 | unsigned int i; | 179 | unsigned int i, j; |
| 229 | const struct kernel_symbol *ks; | ||
| 230 | 180 | ||
| 231 | for (i = 0; i < num; i++) { | 181 | for (j = 0; j < arrsize; j++) { |
| 232 | ks = lookup_symbol(name, arr[i].start, arr[i].stop); | 182 | for (i = 0; i < arr[j].stop - arr[j].start; i++) |
| 233 | if (!ks || !arr[i].check(gplok, warn, name)) | 183 | if (fn(&arr[j], owner, i, data)) |
| 234 | continue; | 184 | return true; |
| 235 | |||
| 236 | if (crc) | ||
| 237 | *crc = symversion(arr[i].crcs, ks - arr[i].start); | ||
| 238 | return ks; | ||
| 239 | } | 185 | } |
| 240 | return NULL; | 186 | |
| 187 | return false; | ||
| 241 | } | 188 | } |
| 242 | 189 | ||
| 243 | /* Find a symbol, return value, (optional) crc and (optional) module | 190 | /* Returns true as soon as fn returns true, otherwise false. */ |
| 244 | * which owns it */ | 191 | static bool each_symbol(bool (*fn)(const struct symsearch *arr, |
| 245 | static unsigned long find_symbol(const char *name, | 192 | struct module *owner, |
| 246 | struct module **owner, | 193 | unsigned int symnum, void *data), |
| 247 | const unsigned long **crc, | 194 | void *data) |
| 248 | bool gplok, | ||
| 249 | bool warn) | ||
| 250 | { | 195 | { |
| 251 | struct module *mod; | 196 | struct module *mod; |
| 252 | const struct kernel_symbol *ks; | ||
| 253 | const struct symsearch arr[] = { | 197 | const struct symsearch arr[] = { |
| 254 | { __start___ksymtab, __stop___ksymtab, __start___kcrctab, | 198 | { __start___ksymtab, __stop___ksymtab, __start___kcrctab, |
| 255 | always_ok }, | 199 | NOT_GPL_ONLY, false }, |
| 256 | { __start___ksymtab_gpl, __stop___ksymtab_gpl, | 200 | { __start___ksymtab_gpl, __stop___ksymtab_gpl, |
| 257 | __start___kcrctab_gpl, gpl_only }, | 201 | __start___kcrctab_gpl, |
| 202 | GPL_ONLY, false }, | ||
| 258 | { __start___ksymtab_gpl_future, __stop___ksymtab_gpl_future, | 203 | { __start___ksymtab_gpl_future, __stop___ksymtab_gpl_future, |
| 259 | __start___kcrctab_gpl_future, warn_if_not_gpl }, | 204 | __start___kcrctab_gpl_future, |
| 205 | WILL_BE_GPL_ONLY, false }, | ||
| 206 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 260 | { __start___ksymtab_unused, __stop___ksymtab_unused, | 207 | { __start___ksymtab_unused, __stop___ksymtab_unused, |
| 261 | __start___kcrctab_unused, printk_unused_warning }, | 208 | __start___kcrctab_unused, |
| 209 | NOT_GPL_ONLY, true }, | ||
| 262 | { __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl, | 210 | { __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl, |
| 263 | __start___kcrctab_unused_gpl, gpl_only_unused_warning }, | 211 | __start___kcrctab_unused_gpl, |
| 212 | GPL_ONLY, true }, | ||
| 213 | #endif | ||
| 264 | }; | 214 | }; |
| 265 | 215 | ||
| 266 | /* Core kernel first. */ | 216 | if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data)) |
| 267 | ks = search_symarrays(arr, ARRAY_SIZE(arr), name, gplok, warn, crc); | 217 | return true; |
| 268 | if (ks) { | ||
| 269 | if (owner) | ||
| 270 | *owner = NULL; | ||
| 271 | return ks->value; | ||
| 272 | } | ||
| 273 | 218 | ||
| 274 | /* Now try modules. */ | ||
| 275 | list_for_each_entry(mod, &modules, list) { | 219 | list_for_each_entry(mod, &modules, list) { |
| 276 | struct symsearch arr[] = { | 220 | struct symsearch arr[] = { |
| 277 | { mod->syms, mod->syms + mod->num_syms, mod->crcs, | 221 | { mod->syms, mod->syms + mod->num_syms, mod->crcs, |
| 278 | always_ok }, | 222 | NOT_GPL_ONLY, false }, |
| 279 | { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms, | 223 | { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms, |
| 280 | mod->gpl_crcs, gpl_only }, | 224 | mod->gpl_crcs, |
| 225 | GPL_ONLY, false }, | ||
| 281 | { mod->gpl_future_syms, | 226 | { mod->gpl_future_syms, |
| 282 | mod->gpl_future_syms + mod->num_gpl_future_syms, | 227 | mod->gpl_future_syms + mod->num_gpl_future_syms, |
| 283 | mod->gpl_future_crcs, warn_if_not_gpl }, | 228 | mod->gpl_future_crcs, |
| 229 | WILL_BE_GPL_ONLY, false }, | ||
| 230 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 284 | { mod->unused_syms, | 231 | { mod->unused_syms, |
| 285 | mod->unused_syms + mod->num_unused_syms, | 232 | mod->unused_syms + mod->num_unused_syms, |
| 286 | mod->unused_crcs, printk_unused_warning }, | 233 | mod->unused_crcs, |
| 234 | NOT_GPL_ONLY, true }, | ||
| 287 | { mod->unused_gpl_syms, | 235 | { mod->unused_gpl_syms, |
| 288 | mod->unused_gpl_syms + mod->num_unused_gpl_syms, | 236 | mod->unused_gpl_syms + mod->num_unused_gpl_syms, |
| 289 | mod->unused_gpl_crcs, gpl_only_unused_warning }, | 237 | mod->unused_gpl_crcs, |
| 238 | GPL_ONLY, true }, | ||
| 239 | #endif | ||
| 290 | }; | 240 | }; |
| 291 | 241 | ||
| 292 | ks = search_symarrays(arr, ARRAY_SIZE(arr), | 242 | if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) |
| 293 | name, gplok, warn, crc); | 243 | return true; |
| 294 | if (ks) { | 244 | } |
| 295 | if (owner) | 245 | return false; |
| 296 | *owner = mod; | 246 | } |
| 297 | return ks->value; | 247 | |
| 248 | struct find_symbol_arg { | ||
| 249 | /* Input */ | ||
| 250 | const char *name; | ||
| 251 | bool gplok; | ||
| 252 | bool warn; | ||
| 253 | |||
| 254 | /* Output */ | ||
| 255 | struct module *owner; | ||
| 256 | const unsigned long *crc; | ||
| 257 | unsigned long value; | ||
| 258 | }; | ||
| 259 | |||
| 260 | static bool find_symbol_in_section(const struct symsearch *syms, | ||
| 261 | struct module *owner, | ||
| 262 | unsigned int symnum, void *data) | ||
| 263 | { | ||
| 264 | struct find_symbol_arg *fsa = data; | ||
| 265 | |||
| 266 | if (strcmp(syms->start[symnum].name, fsa->name) != 0) | ||
| 267 | return false; | ||
| 268 | |||
| 269 | if (!fsa->gplok) { | ||
| 270 | if (syms->licence == GPL_ONLY) | ||
| 271 | return false; | ||
| 272 | if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) { | ||
| 273 | printk(KERN_WARNING "Symbol %s is being used " | ||
| 274 | "by a non-GPL module, which will not " | ||
| 275 | "be allowed in the future\n", fsa->name); | ||
| 276 | printk(KERN_WARNING "Please see the file " | ||
| 277 | "Documentation/feature-removal-schedule.txt " | ||
| 278 | "in the kernel source tree for more details.\n"); | ||
| 298 | } | 279 | } |
| 299 | } | 280 | } |
| 300 | 281 | ||
| 282 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 283 | if (syms->unused && fsa->warn) { | ||
| 284 | printk(KERN_WARNING "Symbol %s is marked as UNUSED, " | ||
| 285 | "however this module is using it.\n", fsa->name); | ||
| 286 | printk(KERN_WARNING | ||
| 287 | "This symbol will go away in the future.\n"); | ||
| 288 | printk(KERN_WARNING | ||
| 289 | "Please evalute if this is the right api to use and if " | ||
| 290 | "it really is, submit a report the linux kernel " | ||
| 291 | "mailinglist together with submitting your code for " | ||
| 292 | "inclusion.\n"); | ||
| 293 | } | ||
| 294 | #endif | ||
| 295 | |||
| 296 | fsa->owner = owner; | ||
| 297 | fsa->crc = symversion(syms->crcs, symnum); | ||
| 298 | fsa->value = syms->start[symnum].value; | ||
| 299 | return true; | ||
| 300 | } | ||
| 301 | |||
| 302 | /* Find a symbol, return value, (optional) crc and (optional) module | ||
| 303 | * which owns it */ | ||
| 304 | static unsigned long find_symbol(const char *name, | ||
| 305 | struct module **owner, | ||
| 306 | const unsigned long **crc, | ||
| 307 | bool gplok, | ||
| 308 | bool warn) | ||
| 309 | { | ||
| 310 | struct find_symbol_arg fsa; | ||
| 311 | |||
| 312 | fsa.name = name; | ||
| 313 | fsa.gplok = gplok; | ||
| 314 | fsa.warn = warn; | ||
| 315 | |||
| 316 | if (each_symbol(find_symbol_in_section, &fsa)) { | ||
| 317 | if (owner) | ||
| 318 | *owner = fsa.owner; | ||
| 319 | if (crc) | ||
| 320 | *crc = fsa.crc; | ||
| 321 | return fsa.value; | ||
| 322 | } | ||
| 323 | |||
| 301 | DEBUGP("Failed to find symbol %s\n", name); | 324 | DEBUGP("Failed to find symbol %s\n", name); |
| 302 | return -ENOENT; | 325 | return -ENOENT; |
| 303 | } | 326 | } |
| 304 | 327 | ||
| 328 | /* lookup symbol in given range of kernel_symbols */ | ||
| 329 | static const struct kernel_symbol *lookup_symbol(const char *name, | ||
| 330 | const struct kernel_symbol *start, | ||
| 331 | const struct kernel_symbol *stop) | ||
| 332 | { | ||
| 333 | const struct kernel_symbol *ks = start; | ||
| 334 | for (; ks < stop; ks++) | ||
| 335 | if (strcmp(ks->name, name) == 0) | ||
| 336 | return ks; | ||
| 337 | return NULL; | ||
| 338 | } | ||
| 339 | |||
| 305 | /* Search for module by name: must hold module_mutex. */ | 340 | /* Search for module by name: must hold module_mutex. */ |
| 306 | static struct module *find_module(const char *name) | 341 | static struct module *find_module(const char *name) |
| 307 | { | 342 | { |
| @@ -639,8 +674,8 @@ static int __try_stop_module(void *_sref) | |||
| 639 | { | 674 | { |
| 640 | struct stopref *sref = _sref; | 675 | struct stopref *sref = _sref; |
| 641 | 676 | ||
| 642 | /* If it's not unused, quit unless we are told to block. */ | 677 | /* If it's not unused, quit unless we're forcing. */ |
| 643 | if ((sref->flags & O_NONBLOCK) && module_refcount(sref->mod) != 0) { | 678 | if (module_refcount(sref->mod) != 0) { |
| 644 | if (!(*sref->forced = try_force_unload(sref->flags))) | 679 | if (!(*sref->forced = try_force_unload(sref->flags))) |
| 645 | return -EWOULDBLOCK; | 680 | return -EWOULDBLOCK; |
| 646 | } | 681 | } |
| @@ -652,9 +687,16 @@ static int __try_stop_module(void *_sref) | |||
| 652 | 687 | ||
| 653 | static int try_stop_module(struct module *mod, int flags, int *forced) | 688 | static int try_stop_module(struct module *mod, int flags, int *forced) |
| 654 | { | 689 | { |
| 655 | struct stopref sref = { mod, flags, forced }; | 690 | if (flags & O_NONBLOCK) { |
| 691 | struct stopref sref = { mod, flags, forced }; | ||
| 656 | 692 | ||
| 657 | return stop_machine_run(__try_stop_module, &sref, NR_CPUS); | 693 | return stop_machine_run(__try_stop_module, &sref, NR_CPUS); |
| 694 | } else { | ||
| 695 | /* We don't need to stop the machine for this. */ | ||
| 696 | mod->state = MODULE_STATE_GOING; | ||
| 697 | synchronize_sched(); | ||
| 698 | return 0; | ||
| 699 | } | ||
| 658 | } | 700 | } |
| 659 | 701 | ||
| 660 | unsigned int module_refcount(struct module *mod) | 702 | unsigned int module_refcount(struct module *mod) |
| @@ -1445,8 +1487,10 @@ static int verify_export_symbols(struct module *mod) | |||
| 1445 | { mod->syms, mod->num_syms }, | 1487 | { mod->syms, mod->num_syms }, |
| 1446 | { mod->gpl_syms, mod->num_gpl_syms }, | 1488 | { mod->gpl_syms, mod->num_gpl_syms }, |
| 1447 | { mod->gpl_future_syms, mod->num_gpl_future_syms }, | 1489 | { mod->gpl_future_syms, mod->num_gpl_future_syms }, |
| 1490 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 1448 | { mod->unused_syms, mod->num_unused_syms }, | 1491 | { mod->unused_syms, mod->num_unused_syms }, |
| 1449 | { mod->unused_gpl_syms, mod->num_unused_gpl_syms }, | 1492 | { mod->unused_gpl_syms, mod->num_unused_gpl_syms }, |
| 1493 | #endif | ||
| 1450 | }; | 1494 | }; |
| 1451 | 1495 | ||
| 1452 | for (i = 0; i < ARRAY_SIZE(arr); i++) { | 1496 | for (i = 0; i < ARRAY_SIZE(arr); i++) { |
| @@ -1526,7 +1570,7 @@ static int simplify_symbols(Elf_Shdr *sechdrs, | |||
| 1526 | } | 1570 | } |
| 1527 | 1571 | ||
| 1528 | /* Update size with this section: return offset. */ | 1572 | /* Update size with this section: return offset. */ |
| 1529 | static long get_offset(unsigned long *size, Elf_Shdr *sechdr) | 1573 | static long get_offset(unsigned int *size, Elf_Shdr *sechdr) |
| 1530 | { | 1574 | { |
| 1531 | long ret; | 1575 | long ret; |
| 1532 | 1576 | ||
| @@ -1738,6 +1782,20 @@ static inline void add_kallsyms(struct module *mod, | |||
| 1738 | } | 1782 | } |
| 1739 | #endif /* CONFIG_KALLSYMS */ | 1783 | #endif /* CONFIG_KALLSYMS */ |
| 1740 | 1784 | ||
| 1785 | static void *module_alloc_update_bounds(unsigned long size) | ||
| 1786 | { | ||
| 1787 | void *ret = module_alloc(size); | ||
| 1788 | |||
| 1789 | if (ret) { | ||
| 1790 | /* Update module bounds. */ | ||
| 1791 | if ((unsigned long)ret < module_addr_min) | ||
| 1792 | module_addr_min = (unsigned long)ret; | ||
| 1793 | if ((unsigned long)ret + size > module_addr_max) | ||
| 1794 | module_addr_max = (unsigned long)ret + size; | ||
| 1795 | } | ||
| 1796 | return ret; | ||
| 1797 | } | ||
| 1798 | |||
| 1741 | /* Allocate and load the module: note that size of section 0 is always | 1799 | /* Allocate and load the module: note that size of section 0 is always |
| 1742 | zero, and we rely on this for optional sections. */ | 1800 | zero, and we rely on this for optional sections. */ |
| 1743 | static struct module *load_module(void __user *umod, | 1801 | static struct module *load_module(void __user *umod, |
| @@ -1764,10 +1822,12 @@ static struct module *load_module(void __user *umod, | |||
| 1764 | unsigned int gplfutureindex; | 1822 | unsigned int gplfutureindex; |
| 1765 | unsigned int gplfuturecrcindex; | 1823 | unsigned int gplfuturecrcindex; |
| 1766 | unsigned int unwindex = 0; | 1824 | unsigned int unwindex = 0; |
| 1825 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 1767 | unsigned int unusedindex; | 1826 | unsigned int unusedindex; |
| 1768 | unsigned int unusedcrcindex; | 1827 | unsigned int unusedcrcindex; |
| 1769 | unsigned int unusedgplindex; | 1828 | unsigned int unusedgplindex; |
| 1770 | unsigned int unusedgplcrcindex; | 1829 | unsigned int unusedgplcrcindex; |
| 1830 | #endif | ||
| 1771 | unsigned int markersindex; | 1831 | unsigned int markersindex; |
| 1772 | unsigned int markersstringsindex; | 1832 | unsigned int markersstringsindex; |
| 1773 | struct module *mod; | 1833 | struct module *mod; |
| @@ -1850,13 +1910,15 @@ static struct module *load_module(void __user *umod, | |||
| 1850 | exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab"); | 1910 | exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab"); |
| 1851 | gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl"); | 1911 | gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl"); |
| 1852 | gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future"); | 1912 | gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future"); |
| 1853 | unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused"); | ||
| 1854 | unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl"); | ||
| 1855 | crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab"); | 1913 | crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab"); |
| 1856 | gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl"); | 1914 | gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl"); |
| 1857 | gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future"); | 1915 | gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future"); |
| 1916 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 1917 | unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused"); | ||
| 1918 | unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl"); | ||
| 1858 | unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused"); | 1919 | unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused"); |
| 1859 | unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl"); | 1920 | unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl"); |
| 1921 | #endif | ||
| 1860 | setupindex = find_sec(hdr, sechdrs, secstrings, "__param"); | 1922 | setupindex = find_sec(hdr, sechdrs, secstrings, "__param"); |
| 1861 | exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table"); | 1923 | exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table"); |
| 1862 | obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm"); | 1924 | obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm"); |
| @@ -1935,7 +1997,7 @@ static struct module *load_module(void __user *umod, | |||
| 1935 | layout_sections(mod, hdr, sechdrs, secstrings); | 1997 | layout_sections(mod, hdr, sechdrs, secstrings); |
| 1936 | 1998 | ||
| 1937 | /* Do the allocs. */ | 1999 | /* Do the allocs. */ |
| 1938 | ptr = module_alloc(mod->core_size); | 2000 | ptr = module_alloc_update_bounds(mod->core_size); |
| 1939 | if (!ptr) { | 2001 | if (!ptr) { |
| 1940 | err = -ENOMEM; | 2002 | err = -ENOMEM; |
| 1941 | goto free_percpu; | 2003 | goto free_percpu; |
| @@ -1943,7 +2005,7 @@ static struct module *load_module(void __user *umod, | |||
| 1943 | memset(ptr, 0, mod->core_size); | 2005 | memset(ptr, 0, mod->core_size); |
| 1944 | mod->module_core = ptr; | 2006 | mod->module_core = ptr; |
| 1945 | 2007 | ||
| 1946 | ptr = module_alloc(mod->init_size); | 2008 | ptr = module_alloc_update_bounds(mod->init_size); |
| 1947 | if (!ptr && mod->init_size) { | 2009 | if (!ptr && mod->init_size) { |
| 1948 | err = -ENOMEM; | 2010 | err = -ENOMEM; |
| 1949 | goto free_core; | 2011 | goto free_core; |
| @@ -2018,14 +2080,15 @@ static struct module *load_module(void __user *umod, | |||
| 2018 | mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; | 2080 | mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; |
| 2019 | mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size / | 2081 | mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size / |
| 2020 | sizeof(*mod->gpl_future_syms); | 2082 | sizeof(*mod->gpl_future_syms); |
| 2021 | mod->num_unused_syms = sechdrs[unusedindex].sh_size / | ||
| 2022 | sizeof(*mod->unused_syms); | ||
| 2023 | mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size / | ||
| 2024 | sizeof(*mod->unused_gpl_syms); | ||
| 2025 | mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr; | 2083 | mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr; |
| 2026 | if (gplfuturecrcindex) | 2084 | if (gplfuturecrcindex) |
| 2027 | mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr; | 2085 | mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr; |
| 2028 | 2086 | ||
| 2087 | #ifdef CONFIG_UNUSED_SYMBOLS | ||
| 2088 | mod->num_unused_syms = sechdrs[unusedindex].sh_size / | ||
| 2089 | sizeof(*mod->unused_syms); | ||
| 2090 | mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size / | ||
| 2091 | sizeof(*mod->unused_gpl_syms); | ||
| 2029 | mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr; | 2092 | mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr; |
| 2030 | if (unusedcrcindex) | 2093 | if (unusedcrcindex) |
| 2031 | mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; | 2094 | mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; |
| @@ -2033,13 +2096,17 @@ static struct module *load_module(void __user *umod, | |||
| 2033 | if (unusedgplcrcindex) | 2096 | if (unusedgplcrcindex) |
| 2034 | mod->unused_gpl_crcs | 2097 | mod->unused_gpl_crcs |
| 2035 | = (void *)sechdrs[unusedgplcrcindex].sh_addr; | 2098 | = (void *)sechdrs[unusedgplcrcindex].sh_addr; |
| 2099 | #endif | ||
| 2036 | 2100 | ||
| 2037 | #ifdef CONFIG_MODVERSIONS | 2101 | #ifdef CONFIG_MODVERSIONS |
| 2038 | if ((mod->num_syms && !crcindex) || | 2102 | if ((mod->num_syms && !crcindex) |
| 2039 | (mod->num_gpl_syms && !gplcrcindex) || | 2103 | || (mod->num_gpl_syms && !gplcrcindex) |
| 2040 | (mod->num_gpl_future_syms && !gplfuturecrcindex) || | 2104 | || (mod->num_gpl_future_syms && !gplfuturecrcindex) |
| 2041 | (mod->num_unused_syms && !unusedcrcindex) || | 2105 | #ifdef CONFIG_UNUSED_SYMBOLS |
| 2042 | (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { | 2106 | || (mod->num_unused_syms && !unusedcrcindex) |
| 2107 | || (mod->num_unused_gpl_syms && !unusedgplcrcindex) | ||
| 2108 | #endif | ||
| 2109 | ) { | ||
| 2043 | printk(KERN_WARNING "%s: No versions for exported symbols.\n", mod->name); | 2110 | printk(KERN_WARNING "%s: No versions for exported symbols.\n", mod->name); |
| 2044 | err = try_to_force_load(mod, "nocrc"); | 2111 | err = try_to_force_load(mod, "nocrc"); |
| 2045 | if (err) | 2112 | if (err) |
| @@ -2512,7 +2579,7 @@ static int m_show(struct seq_file *m, void *p) | |||
| 2512 | struct module *mod = list_entry(p, struct module, list); | 2579 | struct module *mod = list_entry(p, struct module, list); |
| 2513 | char buf[8]; | 2580 | char buf[8]; |
| 2514 | 2581 | ||
| 2515 | seq_printf(m, "%s %lu", | 2582 | seq_printf(m, "%s %u", |
| 2516 | mod->name, mod->init_size + mod->core_size); | 2583 | mod->name, mod->init_size + mod->core_size); |
| 2517 | print_unload_info(m, mod); | 2584 | print_unload_info(m, mod); |
| 2518 | 2585 | ||
| @@ -2595,6 +2662,9 @@ struct module *__module_text_address(unsigned long addr) | |||
| 2595 | { | 2662 | { |
| 2596 | struct module *mod; | 2663 | struct module *mod; |
| 2597 | 2664 | ||
| 2665 | if (addr < module_addr_min || addr > module_addr_max) | ||
| 2666 | return NULL; | ||
| 2667 | |||
| 2598 | list_for_each_entry(mod, &modules, list) | 2668 | list_for_each_entry(mod, &modules, list) |
| 2599 | if (within(addr, mod->module_init, mod->init_text_size) | 2669 | if (within(addr, mod->module_init, mod->init_text_size) |
| 2600 | || within(addr, mod->module_core, mod->core_text_size)) | 2670 | || within(addr, mod->module_core, mod->core_text_size)) |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6b16e16428d8..b859e6b5a767 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -110,7 +110,7 @@ static int min_percpu_pagelist_fract = 8; | |||
| 110 | 110 | ||
| 111 | static int ngroups_max = NGROUPS_MAX; | 111 | static int ngroups_max = NGROUPS_MAX; |
| 112 | 112 | ||
| 113 | #ifdef CONFIG_KMOD | 113 | #ifdef CONFIG_MODULES |
| 114 | extern char modprobe_path[]; | 114 | extern char modprobe_path[]; |
| 115 | #endif | 115 | #endif |
| 116 | #ifdef CONFIG_CHR_DEV_SG | 116 | #ifdef CONFIG_CHR_DEV_SG |
| @@ -475,7 +475,7 @@ static struct ctl_table kern_table[] = { | |||
| 475 | .proc_handler = &ftrace_enable_sysctl, | 475 | .proc_handler = &ftrace_enable_sysctl, |
| 476 | }, | 476 | }, |
| 477 | #endif | 477 | #endif |
| 478 | #ifdef CONFIG_KMOD | 478 | #ifdef CONFIG_MODULES |
| 479 | { | 479 | { |
| 480 | .ctl_name = KERN_MODPROBE, | 480 | .ctl_name = KERN_MODPROBE, |
| 481 | .procname = "modprobe", | 481 | .procname = "modprobe", |
diff --git a/lib/textsearch.c b/lib/textsearch.c index 4b7c6075256f..9fbcb44c554f 100644 --- a/lib/textsearch.c +++ b/lib/textsearch.c | |||
| @@ -267,7 +267,7 @@ struct ts_config *textsearch_prepare(const char *algo, const void *pattern, | |||
| 267 | return ERR_PTR(-EINVAL); | 267 | return ERR_PTR(-EINVAL); |
| 268 | 268 | ||
| 269 | ops = lookup_ts_algo(algo); | 269 | ops = lookup_ts_algo(algo); |
| 270 | #ifdef CONFIG_KMOD | 270 | #ifdef CONFIG_MODULES |
| 271 | /* | 271 | /* |
| 272 | * Why not always autoload you may ask. Some users are | 272 | * Why not always autoload you may ask. Some users are |
| 273 | * in a situation where requesting a module may deadlock, | 273 | * in a situation where requesting a module may deadlock, |
