From: Greg KH <gregkh@linuxfoundation.org>
To: Chen Ridong <chenridong@huaweicloud.com>
Cc: catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org,
stable@vger.kernel.org, lujialin4@huawei.com,
chenridong@huawei.com
Subject: Re: [PATCH 6.6] arm64: kaslr: fix nokaslr cmdline parsing
Date: Wed, 30 Jul 2025 10:56:49 +0200 [thread overview]
Message-ID: <2025073042-sacrifice-cornhusk-a66f@gregkh> (raw)
In-Reply-To: <20250728124644.63207-1-chenridong@huaweicloud.com>
On Mon, Jul 28, 2025 at 12:46:44PM +0000, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> Currently, when the command line contains "nokaslrxxx", it was incorrectly
> treated as a request to disable KASLR virtual memory. However, the behavior
> is different from physical address handling.
>
> This issue exists before the commit af73b9a2dd39 ("arm64: kaslr: Use
> feature override instead of parsing the cmdline again"). This patch fixes
> the parsing logic for the 'nokaslr' command line argument. Only the exact
> strings, 'nokaslr', will disable KASLR. Other inputs such as 'xxnokaslr',
> 'xxnokaslrxx', or 'xxnokaslr=xx' will not disable KASLR.
>
> Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR")
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
> arch/arm64/kernel/pi/kaslr_early.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/pi/kaslr_early.c b/arch/arm64/kernel/pi/kaslr_early.c
> index 17bff6e399e4..731d0a3f1a89 100644
> --- a/arch/arm64/kernel/pi/kaslr_early.c
> +++ b/arch/arm64/kernel/pi/kaslr_early.c
> @@ -35,9 +35,14 @@ static char *__strstr(const char *s1, const char *s2)
> static bool cmdline_contains_nokaslr(const u8 *cmdline)
> {
> const u8 *str;
> + size_t len = strlen("nokaslr");
> + const char *after = cmdline + len;
>
> str = __strstr(cmdline, "nokaslr");
> - return str == cmdline || (str > cmdline && *(str - 1) == ' ');
> + if ((str == cmdline || (str > cmdline && *(str - 1) == ' ')) &&
> + (*after == ' ' || *after == '\0'))
> + return true;
> + return false;
> }
>
> static bool is_kaslr_disabled_cmdline(void *fdt)
> --
> 2.34.1
>
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
prev parent reply other threads:[~2025-07-30 8:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 12:46 [PATCH 6.6] arm64: kaslr: fix nokaslr cmdline parsing Chen Ridong
2025-07-28 14:20 ` Sasha Levin
2025-07-30 8:56 ` Greg KH [this message]
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=2025073042-sacrifice-cornhusk-a66f@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chenridong@huawei.com \
--cc=chenridong@huaweicloud.com \
--cc=lujialin4@huawei.com \
--cc=stable@vger.kernel.org \
--cc=will@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