* + kho-make-sure-kho_scratch-argument-is-fully-consumed.patch added to mm-new branch
@ 2025-08-26 23:04 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-08-26 23:04 UTC (permalink / raw)
To: mm-commits, rppt, graf, changyuanl, bhe, pratyush, akpm
The patch titled
Subject: kho: make sure kho_scratch argument is fully consumed
has been added to the -mm mm-new branch. Its filename is
kho-make-sure-kho_scratch-argument-is-fully-consumed.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kho-make-sure-kho_scratch-argument-is-fully-consumed.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
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 the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Pratyush Yadav <pratyush@kernel.org>
Subject: kho: make sure kho_scratch argument is fully consumed
Date: Tue, 26 Aug 2025 14:38:16 +0200
When specifying fixed sized scratch areas, the parser only parses the
three scratch sizes and ignores the rest of the argument. This means the
argument can have any bogus trailing characters.
For example, "kho_scratch=256M,512M,512Mfoobar" results in successful
parsing:
[ 0.000000] KHO: scratch areas: lowmem: 256MiB global: 512MiB pernode: 512MiB
It is generally a good idea to parse arguments as strictly as possible.
In addition, if bogus trailing characters are allowed in the kho_scratch
argument, it is possible that some people might end up using them and
later extensions to the argument format will cause unexpected breakages.
Make sure the argument is fully consumed after all three scratch sizes are
parsed. With this change, the bogus argument
"kho_scratch=256M,512M,512Mfoobar" results in:
[ 0.000000] Malformed early option 'kho_scratch'
Link: https://lkml.kernel.org/r/20250826123817.64681-1-pratyush@kernel.org
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Changyuan Lyu <changyuanl@google.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/kexec_handover.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/kernel/kexec_handover.c~kho-make-sure-kho_scratch-argument-is-fully-consumed
+++ a/kernel/kexec_handover.c
@@ -451,6 +451,10 @@ static int __init kho_parse_scratch_size
if (!total_size)
return -EINVAL;
+ /* The string should be fully consumed by now. */
+ if (*p)
+ return -EINVAL;
+
scratch_size_lowmem = sizes[0];
scratch_size_global = sizes[1];
scratch_size_pernode = sizes[2];
_
Patches currently in -mm which might be from pratyush@kernel.org are
kho-make-sure-kho_scratch-argument-is-fully-consumed.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-26 23:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 23:04 + kho-make-sure-kho_scratch-argument-is-fully-consumed.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.