module.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. #ifndef _LINUX_MODULE_H
  2. #define _LINUX_MODULE_H
  3. /*
  4. * Dynamic loading of modules into the kernel.
  5. *
  6. * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
  7. * Rewritten again by Rusty Russell, 2002
  8. */
  9. #include <linux/list.h>
  10. #include <linux/stat.h>
  11. #include <linux/compiler.h>
  12. #include <linux/cache.h>
  13. #include <linux/kmod.h>
  14. #include <linux/elf.h>
  15. #include <linux/stringify.h>
  16. #include <linux/kobject.h>
  17. #include <linux/moduleparam.h>
  18. #include <linux/jump_label.h>
  19. #include <linux/export.h>
  20. #include <linux/rbtree_latch.h>
  21. #include <linux/percpu.h>
  22. #include <asm/module.h>
  23. /* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
  24. #define MODULE_SIG_STRING "~Module signature appended~\n"
  25. /* Not Yet Implemented */
  26. #define MODULE_SUPPORTED_DEVICE(name)
  27. #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
  28. struct modversion_info {
  29. unsigned long crc;
  30. char name[MODULE_NAME_LEN];
  31. };
  32. struct module;
  33. struct module_kobject {
  34. struct kobject kobj;
  35. struct module *mod;
  36. struct kobject *drivers_dir;
  37. struct module_param_attrs *mp;
  38. struct completion *kobj_completion;
  39. };
  40. struct module_attribute {
  41. struct attribute attr;
  42. ssize_t (*show)(struct module_attribute *, struct module_kobject *,
  43. char *);
  44. ssize_t (*store)(struct module_attribute *, struct module_kobject *,
  45. const char *, size_t count);
  46. void (*setup)(struct module *, const char *);
  47. int (*test)(struct module *);
  48. void (*free)(struct module *);
  49. };
  50. struct module_version_attribute {
  51. struct module_attribute mattr;
  52. const char *module_name;
  53. const char *version;
  54. } __attribute__ ((__aligned__(sizeof(void *))));
  55. extern ssize_t __modver_version_show(struct module_attribute *,
  56. struct module_kobject *, char *);
  57. extern struct module_attribute module_uevent;
  58. /* These are either module local, or the kernel's dummy ones. */
  59. extern int init_module(void);
  60. extern void cleanup_module(void);
  61. /* Archs provide a method of finding the correct exception table. */
  62. struct exception_table_entry;
  63. const struct exception_table_entry *
  64. search_extable(const struct exception_table_entry *first,
  65. const struct exception_table_entry *last,
  66. unsigned long value);
  67. void sort_extable(struct exception_table_entry *start,
  68. struct exception_table_entry *finish);
  69. void sort_main_extable(void);
  70. void trim_init_extable(struct module *m);
  71. /* Generic info of form tag = "info" */
  72. #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
  73. /* For userspace: you can also call me... */
  74. #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
  75. /* Soft module dependencies. See man modprobe.d for details.
  76. * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz")
  77. */
  78. #define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
  79. /*
  80. * The following license idents are currently accepted as indicating free
  81. * software modules
  82. *
  83. * "GPL" [GNU Public License v2 or later]
  84. * "GPL v2" [GNU Public License v2]
  85. * "GPL and additional rights" [GNU Public License v2 rights and more]
  86. * "Dual BSD/GPL" [GNU Public License v2
  87. * or BSD license choice]
  88. * "Dual MIT/GPL" [GNU Public License v2
  89. * or MIT license choice]
  90. * "Dual MPL/GPL" [GNU Public License v2
  91. * or Mozilla license choice]
  92. *
  93. * The following other idents are available
  94. *
  95. * "Proprietary" [Non free products]
  96. *
  97. * There are dual licensed components, but when running with Linux it is the
  98. * GPL that is relevant so this is a non issue. Similarly LGPL linked with GPL
  99. * is a GPL combined work.
  100. *
  101. * This exists for several reasons
  102. * 1. So modinfo can show license info for users wanting to vet their setup
  103. * is free
  104. * 2. So the community can ignore bug reports including proprietary modules
  105. * 3. So vendors can do likewise based on their own policies
  106. */
  107. #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
  108. /*
  109. * Author(s), use "Name <email>" or just "Name", for multiple
  110. * authors use multiple MODULE_AUTHOR() statements/lines.
  111. */
  112. #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
  113. /* What your module does. */
  114. #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
  115. #ifdef MODULE
  116. /* Creates an alias so file2alias.c can find device table. */
  117. #define MODULE_DEVICE_TABLE(type, name) \
  118. extern const typeof(name) __mod_##type##__##name##_device_table \
  119. __attribute__ ((unused, alias(__stringify(name))))
  120. #else /* !MODULE */
  121. #define MODULE_DEVICE_TABLE(type, name)
  122. #endif
  123. /* Version of form [<epoch>:]<version>[-<extra-version>].
  124. * Or for CVS/RCS ID version, everything but the number is stripped.
  125. * <epoch>: A (small) unsigned integer which allows you to start versions
  126. * anew. If not mentioned, it's zero. eg. "2:1.0" is after
  127. * "1:2.0".
  128. * <version>: The <version> may contain only alphanumerics and the
  129. * character `.'. Ordered by numeric sort for numeric parts,
  130. * ascii sort for ascii parts (as per RPM or DEB algorithm).
  131. * <extraversion>: Like <version>, but inserted for local
  132. * customizations, eg "rh3" or "rusty1".
  133. * Using this automatically adds a checksum of the .c files and the
  134. * local headers in "srcversion".
  135. */
  136. #if defined(MODULE) || !defined(CONFIG_SYSFS)
  137. #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
  138. #else
  139. #define MODULE_VERSION(_version) \
  140. static struct module_version_attribute ___modver_attr = { \
  141. .mattr = { \
  142. .attr = { \
  143. .name = "version", \
  144. .mode = S_IRUGO, \
  145. }, \
  146. .show = __modver_version_show, \
  147. }, \
  148. .module_name = KBUILD_MODNAME, \
  149. .version = _version, \
  150. }; \
  151. static const struct module_version_attribute \
  152. __used __attribute__ ((__section__ ("__modver"))) \
  153. * __moduleparam_const __modver_attr = &___modver_attr
  154. #endif
  155. /* Optional firmware file (or files) needed by the module
  156. * format is simply firmware file name. Multiple firmware
  157. * files require multiple MODULE_FIRMWARE() specifiers */
  158. #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
  159. /* Given an address, look for it in the exception tables */
  160. const struct exception_table_entry *search_exception_tables(unsigned long add);
  161. struct notifier_block;
  162. #ifdef CONFIG_MODULES
  163. extern int modules_disabled; /* for sysctl */
  164. /* Get/put a kernel symbol (calls must be symmetric) */
  165. void *__symbol_get(const char *symbol);
  166. void *__symbol_get_gpl(const char *symbol);
  167. #define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x))))
  168. /* modules using other modules: kdb wants to see this. */
  169. struct module_use {
  170. struct list_head source_list;
  171. struct list_head target_list;
  172. struct module *source, *target;
  173. };
  174. enum module_state {
  175. MODULE_STATE_LIVE, /* Normal state. */
  176. MODULE_STATE_COMING, /* Full formed, running module_init. */
  177. MODULE_STATE_GOING, /* Going away. */
  178. MODULE_STATE_UNFORMED, /* Still setting it up. */
  179. };
  180. struct module;
  181. struct mod_tree_node {
  182. struct module *mod;
  183. struct latch_tree_node node;
  184. };
  185. struct module {
  186. enum module_state state;
  187. /* Member of list of modules */
  188. struct list_head list;
  189. /* Unique handle for this module */
  190. char name[MODULE_NAME_LEN];
  191. /* Sysfs stuff. */
  192. struct module_kobject mkobj;
  193. struct module_attribute *modinfo_attrs;
  194. const char *version;
  195. const char *srcversion;
  196. struct kobject *holders_dir;
  197. /* Exported symbols */
  198. const struct kernel_symbol *syms;
  199. const unsigned long *crcs;
  200. unsigned int num_syms;
  201. /* Kernel parameters. */
  202. #ifdef CONFIG_SYSFS
  203. struct mutex param_lock;
  204. #endif
  205. struct kernel_param *kp;
  206. unsigned int num_kp;
  207. /* GPL-only exported symbols. */
  208. unsigned int num_gpl_syms;
  209. const struct kernel_symbol *gpl_syms;
  210. const unsigned long *gpl_crcs;
  211. #ifdef CONFIG_UNUSED_SYMBOLS
  212. /* unused exported symbols. */
  213. const struct kernel_symbol *unused_syms;
  214. const unsigned long *unused_crcs;
  215. unsigned int num_unused_syms;
  216. /* GPL-only, unused exported symbols. */
  217. unsigned int num_unused_gpl_syms;
  218. const struct kernel_symbol *unused_gpl_syms;
  219. const unsigned long *unused_gpl_crcs;
  220. #endif
  221. #ifdef CONFIG_MODULE_SIG
  222. /* Signature was verified. */
  223. bool sig_ok;
  224. #endif
  225. bool async_probe_requested;
  226. /* symbols that will be GPL-only in the near future. */
  227. const struct kernel_symbol *gpl_future_syms;
  228. const unsigned long *gpl_future_crcs;
  229. unsigned int num_gpl_future_syms;
  230. /* Exception table */
  231. unsigned int num_exentries;
  232. struct exception_table_entry *extable;
  233. /* Startup function. */
  234. int (*init)(void);
  235. /*
  236. * If this is non-NULL, vfree() after init() returns.
  237. *
  238. * Cacheline align here, such that:
  239. * module_init, module_core, init_size, core_size,
  240. * init_text_size, core_text_size and mtn_core::{mod,node[0]}
  241. * are on the same cacheline.
  242. */
  243. void *module_init ____cacheline_aligned;
  244. /* Here is the actual code + data, vfree'd on unload. */
  245. void *module_core;
  246. /* Here are the sizes of the init and core sections */
  247. unsigned int init_size, core_size;
  248. /* The size of the executable code in each section. */
  249. unsigned int init_text_size, core_text_size;
  250. #ifdef CONFIG_MODULES_TREE_LOOKUP
  251. /*
  252. * We want mtn_core::{mod,node[0]} to be in the same cacheline as the
  253. * above entries such that a regular lookup will only touch one
  254. * cacheline.
  255. */
  256. struct mod_tree_node mtn_core;
  257. struct mod_tree_node mtn_init;
  258. #endif
  259. /* Size of RO sections of the module (text+rodata) */
  260. unsigned int init_ro_size, core_ro_size;
  261. /* Arch-specific module values */
  262. struct mod_arch_specific arch;
  263. unsigned int taints; /* same bits as kernel:tainted */
  264. #ifdef CONFIG_GENERIC_BUG
  265. /* Support for BUG */
  266. unsigned num_bugs;
  267. struct list_head bug_list;
  268. struct bug_entry *bug_table;
  269. #endif
  270. #ifdef CONFIG_KALLSYMS
  271. /*
  272. * We keep the symbol and string tables for kallsyms.
  273. * The core_* fields below are temporary, loader-only (they
  274. * could really be discarded after module init).
  275. */
  276. Elf_Sym *symtab, *core_symtab;
  277. unsigned int num_symtab, core_num_syms;
  278. char *strtab, *core_strtab;
  279. /* Section attributes */
  280. struct module_sect_attrs *sect_attrs;
  281. /* Notes attributes */
  282. struct module_notes_attrs *notes_attrs;
  283. #endif
  284. /* The command line arguments (may be mangled). People like
  285. keeping pointers to this stuff */
  286. char *args;
  287. #ifdef CONFIG_SMP
  288. /* Per-cpu data. */
  289. void __percpu *percpu;
  290. unsigned int percpu_size;
  291. #endif
  292. #ifdef CONFIG_TRACEPOINTS
  293. unsigned int num_tracepoints;
  294. struct tracepoint * const *tracepoints_ptrs;
  295. #endif
  296. #ifdef HAVE_JUMP_LABEL
  297. struct jump_entry *jump_entries;
  298. unsigned int num_jump_entries;
  299. #endif
  300. #ifdef CONFIG_TRACING
  301. unsigned int num_trace_bprintk_fmt;
  302. const char **trace_bprintk_fmt_start;
  303. #endif
  304. #ifdef CONFIG_EVENT_TRACING
  305. struct trace_event_call **trace_events;
  306. unsigned int num_trace_events;
  307. struct trace_enum_map **trace_enums;
  308. unsigned int num_trace_enums;
  309. #endif
  310. #ifdef CONFIG_FTRACE_MCOUNT_RECORD
  311. unsigned int num_ftrace_callsites;
  312. unsigned long *ftrace_callsites;
  313. #endif
  314. #ifdef CONFIG_LIVEPATCH
  315. bool klp_alive;
  316. #endif
  317. #ifdef CONFIG_MODULE_UNLOAD
  318. /* What modules depend on me? */
  319. struct list_head source_list;
  320. /* What modules do I depend on? */
  321. struct list_head target_list;
  322. /* Destruction function. */
  323. void (*exit)(void);
  324. atomic_t refcnt;
  325. #endif
  326. #ifdef CONFIG_CONSTRUCTORS
  327. /* Constructor functions. */
  328. ctor_fn_t *ctors;
  329. unsigned int num_ctors;
  330. #endif
  331. } ____cacheline_aligned;
  332. #ifndef MODULE_ARCH_INIT
  333. #define MODULE_ARCH_INIT {}
  334. #endif
  335. extern struct mutex module_mutex;
  336. /* FIXME: It'd be nice to isolate modules during init, too, so they
  337. aren't used before they (may) fail. But presently too much code
  338. (IDE & SCSI) require entry into the module during init.*/
  339. static inline int module_is_live(struct module *mod)
  340. {
  341. return mod->state != MODULE_STATE_GOING;
  342. }
  343. struct module *__module_text_address(unsigned long addr);
  344. struct module *__module_address(unsigned long addr);
  345. bool is_module_address(unsigned long addr);
  346. bool is_module_percpu_address(unsigned long addr);
  347. bool is_module_text_address(unsigned long addr);
  348. static inline bool within_module_core(unsigned long addr,
  349. const struct module *mod)
  350. {
  351. return (unsigned long)mod->module_core <= addr &&
  352. addr < (unsigned long)mod->module_core + mod->core_size;
  353. }
  354. static inline bool within_module_init(unsigned long addr,
  355. const struct module *mod)
  356. {
  357. return (unsigned long)mod->module_init <= addr &&
  358. addr < (unsigned long)mod->module_init + mod->init_size;
  359. }
  360. static inline bool within_module(unsigned long addr, const struct module *mod)
  361. {
  362. return within_module_init(addr, mod) || within_module_core(addr, mod);
  363. }
  364. /* Search for module by name: must hold module_mutex. */
  365. struct module *find_module(const char *name);
  366. struct symsearch {
  367. const struct kernel_symbol *start, *stop;
  368. const unsigned long *crcs;
  369. enum {
  370. NOT_GPL_ONLY,
  371. GPL_ONLY,
  372. WILL_BE_GPL_ONLY,
  373. } licence;
  374. bool unused;
  375. };
  376. /*
  377. * Search for an exported symbol by name.
  378. *
  379. * Must be called with module_mutex held or preemption disabled.
  380. */
  381. const struct kernel_symbol *find_symbol(const char *name,
  382. struct module **owner,
  383. const unsigned long **crc,
  384. bool gplok,
  385. bool warn);
  386. /*
  387. * Walk the exported symbol table
  388. *
  389. * Must be called with module_mutex held or preemption disabled.
  390. */
  391. bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
  392. struct module *owner,
  393. void *data), void *data);
  394. /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
  395. symnum out of range. */
  396. int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
  397. char *name, char *module_name, int *exported);
  398. /* Look for this name: can be of form module:name. */
  399. unsigned long module_kallsyms_lookup_name(const char *name);
  400. int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
  401. struct module *, unsigned long),
  402. void *data);
  403. extern void __module_put_and_exit(struct module *mod, long code)
  404. __attribute__((noreturn));
  405. #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
  406. #ifdef CONFIG_MODULE_UNLOAD
  407. int module_refcount(struct module *mod);
  408. void __symbol_put(const char *symbol);
  409. #define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x))
  410. void symbol_put_addr(void *addr);
  411. /* Sometimes we know we already have a refcount, and it's easier not
  412. to handle the error case (which only happens with rmmod --wait). */
  413. extern void __module_get(struct module *module);
  414. /* This is the Right Way to get a module: if it fails, it's being removed,
  415. * so pretend it's not there. */
  416. extern bool try_module_get(struct module *module);
  417. extern void module_put(struct module *module);
  418. #else /*!CONFIG_MODULE_UNLOAD*/
  419. static inline int try_module_get(struct module *module)
  420. {
  421. return !module || module_is_live(module);
  422. }
  423. static inline void module_put(struct module *module)
  424. {
  425. }
  426. static inline void __module_get(struct module *module)
  427. {
  428. }
  429. #define symbol_put(x) do { } while (0)
  430. #define symbol_put_addr(p) do { } while (0)
  431. #endif /* CONFIG_MODULE_UNLOAD */
  432. int ref_module(struct module *a, struct module *b);
  433. /* This is a #define so the string doesn't get put in every .o file */
  434. #define module_name(mod) \
  435. ({ \
  436. struct module *__mod = (mod); \
  437. __mod ? __mod->name : "kernel"; \
  438. })
  439. /* For kallsyms to ask for address resolution. namebuf should be at
  440. * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
  441. * found, otherwise NULL. */
  442. const char *module_address_lookup(unsigned long addr,
  443. unsigned long *symbolsize,
  444. unsigned long *offset,
  445. char **modname,
  446. char *namebuf);
  447. int lookup_module_symbol_name(unsigned long addr, char *symname);
  448. int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
  449. /* For extable.c to search modules' exception tables. */
  450. const struct exception_table_entry *search_module_extables(unsigned long addr);
  451. int register_module_notifier(struct notifier_block *nb);
  452. int unregister_module_notifier(struct notifier_block *nb);
  453. extern void print_modules(void);
  454. static inline bool module_requested_async_probing(struct module *module)
  455. {
  456. return module && module->async_probe_requested;
  457. }
  458. #else /* !CONFIG_MODULES... */
  459. /* Given an address, look for it in the exception tables. */
  460. static inline const struct exception_table_entry *
  461. search_module_extables(unsigned long addr)
  462. {
  463. return NULL;
  464. }
  465. static inline struct module *__module_address(unsigned long addr)
  466. {
  467. return NULL;
  468. }
  469. static inline struct module *__module_text_address(unsigned long addr)
  470. {
  471. return NULL;
  472. }
  473. static inline bool is_module_address(unsigned long addr)
  474. {
  475. return false;
  476. }
  477. static inline bool is_module_percpu_address(unsigned long addr)
  478. {
  479. return false;
  480. }
  481. static inline bool is_module_text_address(unsigned long addr)
  482. {
  483. return false;
  484. }
  485. /* Get/put a kernel symbol (calls should be symmetric) */
  486. #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
  487. #define symbol_put(x) do { } while (0)
  488. #define symbol_put_addr(x) do { } while (0)
  489. static inline void __module_get(struct module *module)
  490. {
  491. }
  492. static inline int try_module_get(struct module *module)
  493. {
  494. return 1;
  495. }
  496. static inline void module_put(struct module *module)
  497. {
  498. }
  499. #define module_name(mod) "kernel"
  500. /* For kallsyms to ask for address resolution. NULL means not found. */
  501. static inline const char *module_address_lookup(unsigned long addr,
  502. unsigned long *symbolsize,
  503. unsigned long *offset,
  504. char **modname,
  505. char *namebuf)
  506. {
  507. return NULL;
  508. }
  509. static inline int lookup_module_symbol_name(unsigned long addr, char *symname)
  510. {
  511. return -ERANGE;
  512. }
  513. static inline int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name)
  514. {
  515. return -ERANGE;
  516. }
  517. static inline int module_get_kallsym(unsigned int symnum, unsigned long *value,
  518. char *type, char *name,
  519. char *module_name, int *exported)
  520. {
  521. return -ERANGE;
  522. }
  523. static inline unsigned long module_kallsyms_lookup_name(const char *name)
  524. {
  525. return 0;
  526. }
  527. static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
  528. struct module *,
  529. unsigned long),
  530. void *data)
  531. {
  532. return 0;
  533. }
  534. static inline int register_module_notifier(struct notifier_block *nb)
  535. {
  536. /* no events will happen anyway, so this can always succeed */
  537. return 0;
  538. }
  539. static inline int unregister_module_notifier(struct notifier_block *nb)
  540. {
  541. return 0;
  542. }
  543. #define module_put_and_exit(code) do_exit(code)
  544. static inline void print_modules(void)
  545. {
  546. }
  547. static inline bool module_requested_async_probing(struct module *module)
  548. {
  549. return false;
  550. }
  551. #endif /* CONFIG_MODULES */
  552. #ifdef CONFIG_SYSFS
  553. extern struct kset *module_kset;
  554. extern struct kobj_type module_ktype;
  555. extern int module_sysfs_initialized;
  556. #endif /* CONFIG_SYSFS */
  557. #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
  558. /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
  559. #define __MODULE_STRING(x) __stringify(x)
  560. #ifdef CONFIG_DEBUG_SET_MODULE_RONX
  561. extern void set_all_modules_text_rw(void);
  562. extern void set_all_modules_text_ro(void);
  563. #else
  564. static inline void set_all_modules_text_rw(void) { }
  565. static inline void set_all_modules_text_ro(void) { }
  566. #endif
  567. #ifdef CONFIG_GENERIC_BUG
  568. void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
  569. struct module *);
  570. void module_bug_cleanup(struct module *);
  571. #else /* !CONFIG_GENERIC_BUG */
  572. static inline void module_bug_finalize(const Elf_Ehdr *hdr,
  573. const Elf_Shdr *sechdrs,
  574. struct module *mod)
  575. {
  576. }
  577. static inline void module_bug_cleanup(struct module *mod) {}
  578. #endif /* CONFIG_GENERIC_BUG */
  579. #ifdef CONFIG_MODULE_SIG
  580. static inline bool module_sig_ok(struct module *module)
  581. {
  582. return module->sig_ok;
  583. }
  584. #else /* !CONFIG_MODULE_SIG */
  585. static inline bool module_sig_ok(struct module *module)
  586. {
  587. return true;
  588. }
  589. #endif /* CONFIG_MODULE_SIG */
  590. #endif /* _LINUX_MODULE_H */