Modules changes for v6.7-rc1

The only thing worth highligthing is that gzip moves to use vmalloc() instead of
 kmalloc just as we had a fix for this for zstd on v6.6-rc1. The rest is regular
 house keeping, keeping things neat, tidy, and boring.
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCgAwFiEENnNq2KuOejlQLZofziMdCjCSiKcFAmVCsGcSHG1jZ3JvZkBr
 ZXJuZWwub3JnAAoJEM4jHQowkoinbdgP+gKY/a3GGDDkQbNkd3VBiT4h56pixXzG
 Q8kOdRHHfmSIGfnaRvfOs7GPRWClyRcWC5m3TUrObDK7or2BOJATvY9eLg6ax9s2
 1z7AMuH+Bw8D7e5XjOz/UIHc9PbWdVi+nmKY7OXQw/lFPTtts9zdpxq862VAvexW
 AZ3u/gfIm1b8VgyP9U/iXEt8cLb0JYOK0cjqIkdHuOa0EOf3tt6k6pjIaY7jJNLx
 a4IFbp0NiA2ms2F2XOSl9x4dnKIzAA4PYbr5bDpREKywFJYsrw5p4m5zttsVIbtM
 pc3KzyjSuQ+dx0aIeFrKzshuKXaNsLvMIcWIgrcxYnHzBLgF6hgyLcyb1uO2E5bT
 Ig4FF5agE35Hq+gfn1az24kN+9NQm7Mab2OMXA54JWif/YTjLKAMqEA4UPLGeJ7+
 +GBwvvHSEdiw37FmjNQyH9/6Ey7NqG5yiSblyufQqSZjLp/VI0u2qKj4SRHlTYyT
 lIXV/EYT9855PXhWjLRHkUSdBWenKXyrxugBd8/EjsfebsewXhL+ciyPyUnzh8o4
 hlokC+DfBy9znV33uGRo7qj+YHEsd4u5IKTmHzL8EWGBWqeCWxbQPHhysCfvO804
 lvpz44qdDXoNqOPvFkt6JdKt6iO0jwEx7Jk1veK8XXsD8bsDogOs+gemSA5f/wKZ
 4WrEjhptG6yf
 =+tZ8
 -----END PGP SIGNATURE-----

Merge tag 'modules-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux

Pull modules updates from Luis Chamberlain:
 "The only thing worth highligthing is that gzip moves to use vmalloc()
  instead of kmalloc just as we had a fix for this for zstd on v6.6-rc1.

  The rest is regular house keeping, keeping things neat, tidy, and
  boring"

[ The kmalloc -> vmalloc conversion is not the right approach.

  Unless you know you need huge areas or know you need to use virtual
  mappings for some reason (playing with protection bits or whatever),
  you should use kvmalloc()/kvfree, which automatically picks the right
  allocation model    - Linus ]

* tag 'modules-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
  module: Annotate struct module_notes_attrs with __counted_by
  module: Fix comment typo
  module: Make is_valid_name() return bool
  module: Make is_mapping_symbol() return bool
  module/decompress: use vmalloc() for gzip decompression workspace
  MAINTAINERS: add include/linux/module*.h to modules
  module: Clarify documentation of module_param_call()
This commit is contained in:
Linus Torvalds 2023-11-01 21:09:37 -10:00
commit 21e80f3841
7 changed files with 13 additions and 9 deletions

View File

@ -14527,7 +14527,7 @@ L: linux-kernel@vger.kernel.org
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git modules-next
F: include/linux/kmod.h
F: include/linux/module.h
F: include/linux/module*.h
F: kernel/module/
F: lib/test_kmod.c
F: scripts/module*

View File

@ -3,7 +3,7 @@
#define _LINUX_MODULE_SYMBOL_H
/* This ignores the intensely annoying "mapping symbols" found in ELF files. */
static inline int is_mapping_symbol(const char *str)
static inline bool is_mapping_symbol(const char *str)
{
if (str[0] == '.' && str[1] == 'L')
return true;

View File

@ -293,7 +293,11 @@ struct kparam_array
= { __param_str_##name, THIS_MODULE, ops, \
VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
/* Obsolete - use module_param_cb() */
/*
* Useful for describing a set/get pair used only once (i.e. for this
* parameter). For repeated set/get pairs (i.e. the same struct
* kernel_param_ops), use module_param_cb() instead.
*/
#define module_param_call(name, _set, _get, arg, perm) \
static const struct kernel_param_ops __param_ops_##name = \
{ .flags = 0, .set = _set, .get = _get }; \

View File

@ -100,7 +100,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
s.next_in = buf + gzip_hdr_len;
s.avail_in = size - gzip_hdr_len;
s.workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
s.workspace = vmalloc(zlib_inflate_workspacesize());
if (!s.workspace)
return -ENOMEM;
@ -138,7 +138,7 @@ static ssize_t module_gzip_decompress(struct load_info *info,
out_inflate_end:
zlib_inflateEnd(&s);
out:
kfree(s.workspace);
vfree(s.workspace);
return retval;
}
#elif defined(CONFIG_MODULE_COMPRESS_XZ)

View File

@ -126,7 +126,7 @@ static LIST_HEAD(dup_failed_modules);
* These typically should not happen unless your system is under memory
* pressure.
* * invalid_becoming_bytes: total number of bytes allocated and freed used
* used to read the kernel module userspace wants us to read before we
* to read the kernel module userspace wants us to read before we
* promote it to be processed to be added to our @modules linked list. These
* failures can happen if we had a check in between a successful kernel_read_file_from_fd()
* call and right before we allocate the our private memory for the module

View File

@ -143,7 +143,7 @@ static void remove_sect_attrs(struct module *mod)
struct module_notes_attrs {
struct kobject *dir;
unsigned int notes;
struct bin_attribute attrs[];
struct bin_attribute attrs[] __counted_by(notes);
};
static ssize_t module_notes_read(struct file *filp, struct kobject *kobj,

View File

@ -1059,12 +1059,12 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
* only by merging __exit and __init sections into __text, bloating
* the kernel (which is especially evil on embedded platforms).
*/
static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
static inline bool is_valid_name(struct elf_info *elf, Elf_Sym *sym)
{
const char *name = elf->strtab + sym->st_name;
if (!name || !strlen(name))
return 0;
return false;
return !is_mapping_symbol(name);
}