From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev,
Andrea Righi <andrea.righi@canonical.com>,
Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 6.4 2/9] module/decompress: use vmalloc() for zstd decompression workspace
Date: Thu, 31 Aug 2023 13:11:29 +0200 [thread overview]
Message-ID: <20230831111127.784527986@linuxfoundation.org> (raw)
In-Reply-To: <20230831111127.667900990@linuxfoundation.org>
6.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <andrea.righi@canonical.com>
commit a419beac4a070aff63c520f36ebf7cb8a76a8ae5 upstream.
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: 169a58ad824d ("module/decompress: Support zstd in-kernel decompression")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/module/decompress.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/module/decompress.c
+++ b/kernel/module/decompress.c
@@ -241,7 +241,7 @@ static ssize_t module_zstd_decompress(st
}
wksp_size = zstd_dstream_workspace_bound(header.windowSize);
- wksp = kmalloc(wksp_size, GFP_KERNEL);
+ wksp = vmalloc(wksp_size);
if (!wksp) {
retval = -ENOMEM;
goto out;
@@ -284,7 +284,7 @@ static ssize_t module_zstd_decompress(st
retval = new_size;
out:
- kfree(wksp);
+ vfree(wksp);
return retval;
}
#else
next prev parent reply other threads:[~2023-08-31 11:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 11:11 [PATCH 6.4 0/9] 6.4.14-rc1 review Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 1/9] ACPI: thermal: Drop nocrt parameter Greg Kroah-Hartman
2023-08-31 11:11 ` Greg Kroah-Hartman [this message]
2023-08-31 11:11 ` [PATCH 6.4 3/9] module: Expose module_init_layout_section() Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 4/9] arm64: module-plts: inline linux/moduleloader.h Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 5/9] arm64: module: Use module_init_layout_section() to spot init sections Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 6/9] ARM: " Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 7/9] lockdep: fix static memory detection even more Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 8/9] parisc: sys_parisc: parisc_personality() is called from asm code Greg Kroah-Hartman
2023-08-31 11:11 ` [PATCH 6.4 9/9] kallsyms: Fix kallsyms_selftest failure Greg Kroah-Hartman
2023-08-31 21:26 ` [PATCH 6.4 0/9] 6.4.14-rc1 review Florian Fainelli
2023-09-01 1:04 ` SeongJae Park
2023-09-01 6:13 ` Ron Economos
2023-09-01 7:02 ` Bagas Sanjaya
2023-09-01 9:46 ` Sudip Mukherjee (Codethink)
2023-09-01 10:37 ` Naresh Kamboju
2023-09-01 13:42 ` Justin Forbes
2023-09-01 15:22 ` Shuah Khan
2023-09-01 18:46 ` Jon Hunter
2023-09-02 4:19 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230831111127.784527986@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andrea.righi@canonical.com \
--cc=mcgrof@kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).