Re: [PATCH] arm64: Enable CONFIG_COMPAT also for 64k page size

From: Christopher Covington
Date: Wed Feb 18 2015 - 08:41:00 EST


On 12/05/2014 06:05 AM, Catalin Marinas wrote:
> On Fri, Dec 05, 2014 at 10:39:40AM +0000, Arnd Bergmann wrote:
>> On Thursday 04 December 2014 15:48:50 Olof Johansson wrote:
>>> On Thu, Dec 4, 2014 at 3:41 PM, Alexander Graf <agraf@xxxxxxx> wrote:
>>>> On 04.12.14 22:15, Olof Johansson wrote:
>>>>> On Thu, Dec 4, 2014 at 7:46 AM, Alexander Graf <agraf@xxxxxxx> wrote:
>>>>>> With binutils 2.25 the default alignment for 32bit arm sections changed to
>>>>>> have everything 64k aligned. Armv7 binaries built with this binutils version
>>>>>> run successfully on an arm64 system.
>>>>>>
>>>>>> Since effectively there is now the chance to run armv7 code on arm64 even
>>>>>> with 64k page size, it doesn't make sense to block people from enabling
>>>>>> CONFIG_COMPAT on those configurations.
>>>>>>
>>>>>> Signed-off-by: Alexander Graf <agraf@xxxxxxx>
>>>>>> ---
>>>>>> arch/arm64/Kconfig | 1 -
>>>>>> 1 file changed, 1 deletion(-)
>>>>>>
>>>>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>>>>> index 9532f8d..3cf4f238 100644
>>>>>> --- a/arch/arm64/Kconfig
>>>>>> +++ b/arch/arm64/Kconfig
>>>>>> @@ -409,7 +409,6 @@ source "fs/Kconfig.binfmt"
>>>>>>
>>>>>> config COMPAT
>>>>>> bool "Kernel support for 32-bit EL0"
>>>>>> - depends on !ARM64_64K_PAGES
>>>>>> select COMPAT_BINFMT_ELF
>>>>>> select HAVE_UID16
>>>>>> select OLD_SIGSUSPEND3
>>>>>
>>>>> This is hardly "compat". Sure, it's great to have a new binutils that
>>>>> has larger alignment, but practically not a single existing binary
>>>>> will work today if someone tries to do this.
>>>>
>>>> Yes, but IMHO that's an implementation detail. The same applies for
>>>> 32bit PPC binaries if you use 4k aligned segments. If your applications
>>>> are not aligned for your page size, you can't run them. The only
>>>> platform that managed nevertheless FWIW was IA64 ;).
>>>
>>> Yes, but there the binutils change happened early enough that by the
>>> time the kernel change went in, all major distros had binaries that
>>> were compatible.
>>
>> What is the exact symptom you see when running an unaligned user
>> space binary on 64k-pages? Do we at least print a helpful error
>> message somewhere or does it just crash?
>
> The application doesn't even start because it cannot map page 0. It
> looks like most 32-bit arm binaries are linked to be loaded at 32K.

I looked at this briefly and the first problem I narrowed in on was underflow
in the calculation of the off variable in elf_map().

http://lxr.free-electrons.com/source/fs/binfmt_elf.c?v=3.18#L341

Chris

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/