mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guoheyi <guoheyi@huawei.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <wanghaibin.wang@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>
Subject: Re: [PATCH] arm64/kernel/entry: refine comment of stack overflow check
Date: Tue, 3 Dec 2019 08:55:53 +0800	[thread overview]
Message-ID: <0aee0354-5153-940c-bf72-7bd6bccce490@huawei.com> (raw)
In-Reply-To: <20191202123319.GA25809@lakrids.cambridge.arm.com>


在 2019/12/2 20:33, Mark Rutland 写道:
> On Mon, Dec 02, 2019 at 07:37:02PM +0800, Heyi Guo wrote:
>> Stack overflow checking can be done by testing
>> sp & (1 << THREAD_SHIFT)
>> only for the stacks are aligned to (2 << THREAD_SHIFT) with size of
>> (1 << THREAD_SIZE), and this is the case when CONFIG_VMAP_STACK is
>> set.
> Good point, I was sloppy with this comment.
>
>> Fix the code comment to avoid confusion.
>>
>> Signed-off-by: Heyi Guo <guoheyi@huawei.com>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> ---
>>   arch/arm64/kernel/entry.S | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
>> index cf3bd2976e57..9e8ba507090f 100644
>> --- a/arch/arm64/kernel/entry.S
>> +++ b/arch/arm64/kernel/entry.S
>> @@ -76,7 +76,8 @@ alternative_else_nop_endif
>>   #ifdef CONFIG_VMAP_STACK
>>   	/*
>>   	 * Test whether the SP has overflowed, without corrupting a GPR.
>> -	 * Task and IRQ stacks are aligned to (1 << THREAD_SHIFT).
>> +	 * Task and IRQ stacks are aligned to (2 << THREAD_SHIFT) with size of
>> +	 * (1 << THREAD_SHIFT).
>>   	 */
> Can we make that:
>
> 	Task and IRQ stacks are aligned so that SP & (1 << THREAD_SHIFT)
> 	should always be zero.
>
> ... which I think is a bit clearer.

Sure :)

Thanks,

Heyi

>
> With that wording:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> Mark.
>
>>   	add	sp, sp, x0			// sp' = sp + x0
>>   	sub	x0, sp, x0			// x0' = sp' - x0 = (sp + x0) - x0 = sp
>> -- 
>> 2.19.1
>>
> .


  reply	other threads:[~2019-12-03  0:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 11:37 Heyi Guo
2019-12-02 12:33 ` Mark Rutland
2019-12-03  0:55   ` Guoheyi [this message]
2019-12-06 13:58 ` Catalin Marinas

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=0aee0354-5153-940c-bf72-7bd6bccce490@huawei.com \
    --to=guoheyi@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    --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

all inboxes | Powered by JetHome®