From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,scott.branden@broadcom.com,mcgrof@kernel.org,kees@kernel.org,akpm@linux-foundation.org,sam.moelius@trailofbits.com,akpm@linux-foundation.org
Subject: + lib-test_firmware-allocate-the-configured-into_buf-size.patch added to mm-nonmm-unstable branch
Date: Fri, 05 Jun 2026 18:45:55 -0700 [thread overview]
Message-ID: <20260606014555.88F6B1F00893@smtp.kernel.org> (raw)
The patch titled
Subject: lib/test_firmware: allocate the configured into_buf size
has been added to the -mm mm-nonmm-unstable branch. Its filename is
lib-test_firmware-allocate-the-configured-into_buf-size.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-test_firmware-allocate-the-configured-into_buf-size.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Samuel Moelius <sam.moelius@trailofbits.com>
Subject: lib/test_firmware: allocate the configured into_buf size
Date: Fri, 5 Jun 2026 00:30:37 +0000
The batched into_buf test path allocates TEST_FIRMWARE_BUF_SIZE bytes
unconditionally, but then passes test_fw_config->buf_size to
request_firmware_into_buf() or request_partial_firmware_into_buf().
Userspace can set config_buf_size above TEST_FIRMWARE_BUF_SIZE before
triggering a batched request. If the firmware file is large enough, the
firmware loader writes past the end of the 1 KiB test buffer.
Allocate the buffer with the same size that the test passes to the firmware
API so config_buf_size remains the actual buffer size under test.
Assisted-by: Codex:gpt-5.5-cyber-preview
Link: https://lore.kernel.org/20260605003038.2005840-1-sam.moelius@trailofbits.com
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/test_firmware.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/test_firmware.c~lib-test_firmware-allocate-the-configured-into_buf-size
+++ a/lib/test_firmware.c
@@ -867,7 +867,7 @@ static int test_fw_run_batch_request(voi
if (test_fw_config->into_buf) {
void *test_buf;
- test_buf = kzalloc(TEST_FIRMWARE_BUF_SIZE, GFP_KERNEL);
+ test_buf = kzalloc(test_fw_config->buf_size, GFP_KERNEL);
if (!test_buf)
return -ENOMEM;
_
Patches currently in -mm which might be from sam.moelius@trailofbits.com are
mm-page_frag-reject-invalid-cpus-in-page_frag_test.patch
lib-test_firmware-allocate-the-configured-into_buf-size.patch
reply other threads:[~2026-06-06 1:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260606014555.88F6B1F00893@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=kees@kernel.org \
--cc=mcgrof@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=sam.moelius@trailofbits.com \
--cc=scott.branden@broadcom.com \
/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