From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: fix randomized task_struct
Date: Fri, 30 Jun 2017 17:55:19 +0200 [thread overview]
Message-ID: <CAK8P3a1oJjzOh1fRh+0gYDcf27pCTVwwfQcb2DPfx7tmwQE2Qg@mail.gmail.com> (raw)
In-Reply-To: <9291740E-3BD1-454C-A3EB-46E35F073D0E@linaro.org>
On Fri, Jun 30, 2017 at 5:49 PM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>> On 30 Jun 2017, at 15:34, Arnd Bergmann <arnd@arndb.de> wrote:
>>
>> With the new task struct randomization, we can run into a build
>> failure for certain random seeds:
>>
>> arch/arm/kernel/entry-armv.S: Assembler messages:
>> arch/arm/kernel/entry-armv.S:803: Error: bad immediate value for offset (4096)
>>
>> Only two constants in asm-offset.h are affected, and I'm changing
>> both of them here to work correctly in all configurations.
>>
>> One more macro has the problem, but is currently unused, so this
>> removes it instead of adding complexity.
>>
>> Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Fixes: c33d8b12fbbd ("task_struct: Allow randomized layout")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> arch/arm/kernel/entry-armv.S | 5 ++++-
>> arch/arm/mm/proc-macros.S | 10 ++++------
>> 2 files changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
>> index 9f157e7c51e7..db6d22b23bd8 100644
>> --- a/arch/arm/kernel/entry-armv.S
>> +++ b/arch/arm/kernel/entry-armv.S
>> @@ -797,7 +797,10 @@ ENTRY(__switch_to)
>> #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
>> ldr r7, [r2, #TI_TASK]
>> ldr r8, =__stack_chk_guard
>> - ldr r7, [r7, #TSK_STACK_CANARY]
>> + .if (TSK_STACK_CANARY > PAGE_MASK)
>
> Shouldn't this be ~PAGE_MASK?
>
> I think
>
> .if (TSK_STACK_CANARY & PAGE_MASK) != 0
>
> is better and clearer as well
Right, sorry about that. Russell also pointed out that PAGE_MASK
is not the best constant for this, as the MMU page size is independent
of the definition of the immediate arguments. I'll fix both and resend.
Arnd
prev parent reply other threads:[~2017-06-30 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 15:34 [PATCH] ARM: fix randomized task_struct Arnd Bergmann
2017-06-30 15:49 ` Ard Biesheuvel
2017-06-30 15:55 ` Russell King - ARM Linux
2017-06-30 17:34 ` Ard Biesheuvel
2017-06-30 15:55 ` Arnd Bergmann [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=CAK8P3a1oJjzOh1fRh+0gYDcf27pCTVwwfQcb2DPfx7tmwQE2Qg@mail.gmail.com \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).