Commit 312dcaf9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'modules-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux

Pull modules updates from Jessica Yu:
 "Summary of modules changes for the 5.11 merge window:

   - Fix a race condition between systemd/udev and the module loader.

     The module loader was sending a uevent before the module was fully
     initialized (i.e., before its init function has been called). This
     means udev can start processing the module uevent before the module
     has finished initializing, and some udev rules expect that the
     module has initialized already upon receiving the uevent.

     This resulted in some systemd mount units failing if udev processes
     the event faster than the module can finish init. This is fixed by
     delaying the uevent until after the module has called its init
     routine.

   - Make the linker array sections for kernel params and module version
     attributes more robust by switching to use the alignment of the
     type in question.

     Namely, linker section arrays will be constructed using the
     alignment required by the struct (using __alignof__()) as opposed
     to a specific value such as sizeof(void *) or sizeof(long). This is
     less likely to cause breakages should the size of the type ever
     change (Johan Hovold)

   - Fix module state inconsistency by setting it back to GOING when a
     module fails to load and is on its way out (Miroslav Benes)

   - Some comment and code cleanups (Sergey Shtylyov)"

* tag 'modules-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
  module: delay kobject uevent until after module init call
  module: drop semicolon from version macro
  init: use type alignment for kernel parameters
  params: clean up module-param macros
  params: use type alignment for kernel parameters
  params: drop redundant "unused" attributes
  module: simplify version-attribute handling
  module: drop version-attribute alignment
  module: fix comment style
  module: add more 'kernel-doc' comments
  module: fix up 'kernel-doc' comments
  module: only handle errors with the *switch* statement in module_sig_check()
  module: avoid *goto*s in module_sig_check()
  module: merge repetitive strings in module_sig_check()
  module: set MODULE_STATE_GOING state when a module fails to load
parents 6daa9043 38dc717e
...@@ -255,7 +255,7 @@ struct obs_kernel_param { ...@@ -255,7 +255,7 @@ struct obs_kernel_param {
__aligned(1) = str; \ __aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \ static struct obs_kernel_param __setup_##unique_id \
__used __section(".init.setup") \ __used __section(".init.setup") \
__attribute__((aligned((sizeof(long))))) \ __aligned(__alignof__(struct obs_kernel_param)) \
= { __setup_str_##unique_id, fn, early } = { __setup_str_##unique_id, fn, early }
#define __setup(str, fn) \ #define __setup(str, fn) \
......
...@@ -66,7 +66,7 @@ struct module_version_attribute { ...@@ -66,7 +66,7 @@ struct module_version_attribute {
struct module_attribute mattr; struct module_attribute mattr;
const char *module_name; const char *module_name;
const char *version; const char *version;
} __attribute__ ((__aligned__(sizeof(void *)))); };
extern ssize_t __modver_version_show(struct module_attribute *, extern ssize_t __modver_version_show(struct module_attribute *,
struct module_kobject *, char *); struct module_kobject *, char *);
...@@ -266,20 +266,20 @@ extern typeof(name) __mod_##type##__##name##_device_table \ ...@@ -266,20 +266,20 @@ extern typeof(name) __mod_##type##__##name##_device_table \
#else #else
#define MODULE_VERSION(_version) \ #define MODULE_VERSION(_version) \
MODULE_INFO(version, _version); \ MODULE_INFO(version, _version); \
static struct module_version_attribute ___modver_attr = { \ static struct module_version_attribute __modver_attr \
.mattr = { \ __used __section("__modver") \
.attr = { \ __aligned(__alignof__(struct module_version_attribute)) \
.name = "version", \ = { \
.mode = S_IRUGO, \ .mattr = { \
.attr = { \
.name = "version", \
.mode = S_IRUGO, \
}, \
.show = __modver_version_show, \
}, \ }, \
.show = __modver_version_show, \ .module_name = KBUILD_MODNAME, \
}, \ .version = _version, \
.module_name = KBUILD_MODNAME, \ }
.version = _version, \
}; \
static const struct module_version_attribute \
__used __section("__modver") \
* __moduleparam_const __modver_attr = &___modver_attr
#endif #endif
/* Optional firmware file (or files) needed by the module /* Optional firmware file (or files) needed by the module
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
#define __MODULE_INFO(tag, name, info) \ #define __MODULE_INFO(tag, name, info) \
static const char __UNIQUE_ID(name)[] \ static const char __UNIQUE_ID(name)[] \
__used __section(".modinfo") __attribute__((unused, aligned(1))) \ __used __section(".modinfo") __aligned(1) \
= __MODULE_INFO_PREFIX __stringify(tag) "=" info = __MODULE_INFO_PREFIX __stringify(tag) "=" info
#define __MODULE_PARM_TYPE(name, _type) \ #define __MODULE_PARM_TYPE(name, _type) \
__MODULE_INFO(parmtype, name##type, #name ":" _type) __MODULE_INFO(parmtype, name##type, #name ":" _type)
/* One for each parameter, describing how to use it. Some files do /* One for each parameter, describing how to use it. Some files do
multiple of these per line, so can't just use MODULE_INFO. */ multiple of these per line, so can't just use MODULE_INFO. */
...@@ -288,8 +288,8 @@ struct kparam_array ...@@ -288,8 +288,8 @@ struct kparam_array
/* Default value instead of permissions? */ \ /* Default value instead of permissions? */ \
static const char __param_str_##name[] = prefix #name; \ static const char __param_str_##name[] = prefix #name; \
static struct kernel_param __moduleparam_const __param_##name \ static struct kernel_param __moduleparam_const __param_##name \
__used \ __used __section("__param") \
__section("__param") __attribute__ ((unused, aligned(sizeof(void *)))) \ __aligned(__alignof__(struct kernel_param)) \
= { __param_str_##name, THIS_MODULE, ops, \ = { __param_str_##name, THIS_MODULE, ops, \
VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
......
This diff is collapsed.
...@@ -843,18 +843,16 @@ ssize_t __modver_version_show(struct module_attribute *mattr, ...@@ -843,18 +843,16 @@ ssize_t __modver_version_show(struct module_attribute *mattr,
return scnprintf(buf, PAGE_SIZE, "%s\n", vattr->version); return scnprintf(buf, PAGE_SIZE, "%s\n", vattr->version);
} }
extern const struct module_version_attribute *__start___modver[]; extern const struct module_version_attribute __start___modver[];
extern const struct module_version_attribute *__stop___modver[]; extern const struct module_version_attribute __stop___modver[];
static void __init version_sysfs_builtin(void) static void __init version_sysfs_builtin(void)
{ {
const struct module_version_attribute **p; const struct module_version_attribute *vattr;
struct module_kobject *mk; struct module_kobject *mk;
int err; int err;
for (p = __start___modver; p < __stop___modver; p++) { for (vattr = __start___modver; vattr < __stop___modver; vattr++) {
const struct module_version_attribute *vattr = *p;
mk = locate_module_kobject(vattr->module_name); mk = locate_module_kobject(vattr->module_name);
if (mk) { if (mk) {
err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment