linux-stable/kernel/module
Andrea Righi f20c4b0c01 module/decompress: use vmalloc() for gzip decompression workspace
[ Upstream commit 3737df782c ]

Use a similar approach as commit a419beac4a ("module/decompress: use
vmalloc() for zstd decompression workspace") and replace kmalloc() with
vmalloc() also for the gzip module decompression workspace.

In this case the workspace is represented by struct inflate_workspace
that can be fairly large for kmalloc() and it can potentially lead to
allocation errors on certain systems:

$ pahole inflate_workspace
struct inflate_workspace {
	struct inflate_state       inflate_state;        /*     0  9544 */
	/* --- cacheline 149 boundary (9536 bytes) was 8 bytes ago --- */
	unsigned char              working_window[32768]; /*  9544 32768 */

	/* size: 42312, cachelines: 662, members: 2 */
	/* last cacheline: 8 bytes */
};

Considering that there is no need to use continuous physical memory,
simply switch to vmalloc() to provide a more reliable in-kernel module
decompression.

Fixes: b1ae6dc41e ("module: add in-kernel support for decompressing")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:52:03 +01:00
..
debug_kmemleak.c
decompress.c module/decompress: use vmalloc() for gzip decompression workspace 2023-11-20 11:52:03 +01:00
internal.h dyndbg: gather __dyndbg[] state into struct _ddebug_info 2022-09-07 17:04:48 +02:00
kallsyms.c module: Increase readability of module_kallsyms_lookup_name() 2022-07-11 10:49:14 -07:00
Kconfig module: Move module's Kconfig items in kernel/module/ 2022-07-12 12:07:25 -07:00
kdb.c
livepatch.c
main.c modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules 2023-09-06 21:27:00 +01:00
Makefile
procfs.c module: Modify module_flags() to accept show_state argument 2022-07-14 17:40:23 -07:00
signing.c
strict_rwx.c
sysfs.c
tracking.c module: tracking: Keep a record of tainted unloaded modules only 2022-10-10 12:16:19 -07:00
tree_lookup.c
version.c