mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Zhichi Lin <zhichi.lin@vivo.com>
Cc: elver@google.com, will@kernel.org, andreyknvl@gmail.com,
	samitolvanen@google.com, yee.lee@mediatek.com,
	keescook@chromium.org, linux-kernel@vger.kernel.org,
	xiejiyuan@vivo.com
Subject: Re: [PATCH] scs: Fix a wrong parameter in __scs_magic
Date: Sat, 11 Oct 2025 10:11:17 -0700	[thread overview]
Message-ID: <20251011101117.0b48ecef0dc7cfdd1f871273@linux-foundation.org> (raw)
In-Reply-To: <20251011082222.12965-1-zhichi.lin@vivo.com>

On Sat, 11 Oct 2025 16:22:22 +0800 Zhichi Lin <zhichi.lin@vivo.com> wrote:

> __scs_magic() needs a 'void *' variable, but a 'struct task_struct *'
> is given. 'task_scs(tsk)' is the starting address of the task's shadow
> call stack, and '__scs_magic(task_scs(tsk))' is the end address of the
> task's shadow call stack.
> Here should be '__scs_magic(task_scs(tsk))'.

What are the userspace-visible runtime effects of this bug?  Please
always describe this when fixing something.

> Fixes: 5bbaf9d1fcb9 ("scs: Add support for stack usage debugging")

This might need backporting into -stable kernels, that depends on the
answer to the above question.

> --- a/kernel/scs.c
> +++ b/kernel/scs.c
> @@ -135,7 +135,7 @@ static void scs_check_usage(struct task_struct *tsk)
>  	if (!IS_ENABLED(CONFIG_DEBUG_STACK_USAGE))
>  		return;
>  
> -	for (p = task_scs(tsk); p < __scs_magic(tsk); ++p) {
> +	for (p = task_scs(tsk); p < __scs_magic(task_scs(tsk)); ++p) {
>  		if (!READ_ONCE_NOCHECK(*p))
>  			break;
>  		used += sizeof(*p);

Thanks, I'll grab the patch for now, maybe Will would prefer to take it?

  reply	other threads:[~2025-10-11 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11  8:22 Zhichi Lin
2025-10-11 17:11 ` Andrew Morton [this message]
2025-10-13  8:19   ` 林芝驰
2025-10-30 13:10   ` Will Deacon
2025-10-13 22:45 ` Sami Tolvanen
  -- strict thread matches above, loose matches on Subject: below --
2022-07-04  7:04 Wan Jiabing
2022-07-05  9:58 ` Will Deacon

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=20251011101117.0b48ecef0dc7cfdd1f871273@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=elver@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=will@kernel.org \
    --cc=xiejiyuan@vivo.com \
    --cc=yee.lee@mediatek.com \
    --cc=zhichi.lin@vivo.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

all inboxes | Powered by JetHome®