From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
stable@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
Jann Horn <jannh@google.com>
Subject: Re: [PATCH] arm64: compat: Reduce address limit
Date: Mon, 1 Apr 2019 12:27:46 +0100 [thread overview]
Message-ID: <5b732920-b067-219c-ffd7-3ce99f1b4446@arm.com> (raw)
In-Reply-To: <20190401105913.GC14874@arrakis.emea.arm.com>
On 01/04/2019 11:59, Catalin Marinas wrote:
> On Mon, Apr 01, 2019 at 11:32:01AM +0100, Vincenzo Frascino wrote:
>> Currently, compat tasks running on arm64 can allocate memory up to
>> TASK_SIZE_32 (UL(0x100000000)).
>>
>> This means that mmap() allocations, if we treat them as returning an
>> array, are not compliant with the sections 6.5.8 of the C standard
>> (C99) which states that: "If the expression P points to an element of
>> an array object and the expression Q points to the last element of the
>> same array object, the pointer expression Q+1 compares greater than P".
>>
>> Redefine TASK_SIZE_32 to address the issue.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will.deacon@arm.com>
>> Cc: Jann Horn <jannh@google.com>
>> Reported-by: Jann Horn <jannh@google.com>
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
>> ---
>> arch/arm64/include/asm/processor.h | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
>> index 5d9ce62bdebd..f8235f7df29b 100644
>> --- a/arch/arm64/include/asm/processor.h
>> +++ b/arch/arm64/include/asm/processor.h
>> @@ -57,7 +57,11 @@
>> #define TASK_SIZE_64 (UL(1) << vabits_user)
>>
>> #ifdef CONFIG_COMPAT
>> +#ifdef CONFIG_ARM64_64K_PAGES
>> #define TASK_SIZE_32 UL(0x100000000)
>> +#else
>> +#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE)
>> +#endif /* CONFIG_ARM64_64K_PAGES */
>
> I'd add a comment above stating that with the 64K page configuration,
> the last page is occupied by the compat vectors page.
>
Ok, I will post v2 shortly.
--
Regards,
Vincenzo
prev parent reply other threads:[~2019-04-01 11:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 10:32 [PATCH] arm64: compat: Reduce address limit Vincenzo Frascino
2019-04-01 10:59 ` Catalin Marinas
2019-04-01 11:27 ` Vincenzo Frascino [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=5b732920-b067-219c-ffd7-3ce99f1b4446@arm.com \
--to=vincenzo.frascino@arm.com \
--cc=catalin.marinas@arm.com \
--cc=jannh@google.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.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