linux/kernel/module
Andrea Righi a419beac4a module/decompress: use vmalloc() for zstd decompression workspace
Using kmalloc() to allocate the decompression workspace for zstd may
trigger the following warning when large modules are loaded (i.e., xfs):

[    2.961884] WARNING: CPU: 1 PID: 254 at mm/page_alloc.c:4453 __alloc_pages+0x2c3/0x350
...
[    2.989033] Call Trace:
[    2.989841]  <TASK>
[    2.990614]  ? show_regs+0x6d/0x80
[    2.991573]  ? __warn+0x89/0x160
[    2.992485]  ? __alloc_pages+0x2c3/0x350
[    2.993520]  ? report_bug+0x17e/0x1b0
[    2.994506]  ? handle_bug+0x51/0xa0
[    2.995474]  ? exc_invalid_op+0x18/0x80
[    2.996469]  ? asm_exc_invalid_op+0x1b/0x20
[    2.997530]  ? module_zstd_decompress+0xdc/0x2a0
[    2.998665]  ? __alloc_pages+0x2c3/0x350
[    2.999695]  ? module_zstd_decompress+0xdc/0x2a0
[    3.000821]  __kmalloc_large_node+0x7a/0x150
[    3.001920]  __kmalloc+0xdb/0x170
[    3.002824]  module_zstd_decompress+0xdc/0x2a0
[    3.003857]  module_decompress+0x37/0xc0
[    3.004688]  init_module_from_file+0xd0/0x100
[    3.005668]  idempotent_init_module+0x11c/0x2b0
[    3.006632]  __x64_sys_finit_module+0x64/0xd0
[    3.007568]  do_syscall_64+0x59/0x90
[    3.008373]  ? ksys_read+0x73/0x100
[    3.009395]  ? exit_to_user_mode_prepare+0x30/0xb0
[    3.010531]  ? syscall_exit_to_user_mode+0x37/0x60
[    3.011662]  ? do_syscall_64+0x68/0x90
[    3.012511]  ? do_syscall_64+0x68/0x90
[    3.013364]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8

However, continuous physical memory does not seem to be required in
module_zstd_decompress(), so use vmalloc() instead, to prevent the
warning and avoid potential failures at loading compressed modules.

Fixes: 169a58ad82 ("module/decompress: Support zstd in-kernel decompression")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
2023-08-29 09:39:08 -07:00
..
debug_kmemleak.c
decompress.c module/decompress: use vmalloc() for zstd decompression workspace 2023-08-29 09:39:08 -07:00
dups.c module: include internal.h in module/dups.c 2023-05-02 20:33:36 -07:00
internal.h kbuild: generate KSYMTAB entries by modpost 2023-06-22 21:17:10 +09:00
kallsyms.c modpost, kallsyms: Treat add '$'-prefixed symbols as mapping symbols 2023-07-24 12:09:47 -07:00
Kconfig module: add debugging auto-load duplicate module support 2023-04-19 17:26:01 -07:00
kdb.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
kmod.c module: add debugging auto-load duplicate module support 2023-04-19 17:26:01 -07:00
livepatch.c livepatch: fix ELF typos 2023-03-09 11:08:24 +01:00
main.c module: Expose module_init_layout_section() 2023-08-03 13:42:02 -07:00
Makefile module: add debugging auto-load duplicate module support 2023-04-19 17:26:01 -07:00
procfs.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
signing.c
stats.c module: Fix use-after-free bug in read_file_mod_stats() 2023-05-22 14:13:13 -07:00
strict_rwx.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
sysfs.c module: remove redundant module_sysfs_initialized variable 2022-11-11 10:19:52 -08:00
tracking.c module: add debug stats to help identify memory pressure 2023-04-18 11:15:24 -07:00
tree_lookup.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
version.c