[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190911165341.GA40932@google.com>
Date: Wed, 11 Sep 2019 17:53:41 +0100
From: Matthias Maennich <maennich@...gle.com>
To: Will Deacon <will@...nel.org>
Cc: Jessica Yu <jeyu@...nel.org>, linux-kernel@...r.kernel.org,
maco@...roid.com, gregkh@...uxfoundation.org,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Catalin Marinas <catalin.marinas@....com>,
kernel-team@...roid.com
Subject: Re: [PATCH] module: Fix link failure due to invalid relocation on
namespace offset
On Wed, Sep 11, 2019 at 05:40:13PM +0100, Will Deacon wrote:
>On Wed, Sep 11, 2019 at 03:35:06PM +0200, Jessica Yu wrote:
>> +++ Will Deacon [11/09/19 13:26 +0100]:
>> > Commit 8651ec01daed ("module: add support for symbol namespaces.")
>> > broke linking for arm64 defconfig:
>> >
>> > | lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey':
>> > | arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
>> > | lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt':
>> > | arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol'
>> >
>> > This is because the dummy initialisation of the 'namespace_offset' field
>> > in 'struct kernel_symbol' when using EXPORT_SYMBOL on architectures with
>> > support for PREL32 locations uses an offset from an absolute address (0)
>> > in an effort to trick 'offset_to_pointer' into behaving as a NOP,
>> > allowing non-namespaced symbols to be treated in the same way as those
>> > belonging to a namespace.
>> >
>> > Unfortunately, place-relative relocations require a symbol reference
>> > rather than an absolute value and, although x86 appears to get away with
>> > this due to placing the kernel text at the top of the address space, it
>> > almost certainly results in a runtime failure if the kernel is relocated
>> > dynamically as a result of KASLR.
>> >
>> > Rework 'namespace_offset' so that a value of 0, which cannot occur for a
>> > valid namespaced symbol, indicates that the corresponding symbol does
>> > not belong to a namespace.
>> >
>> > Cc: Matthias Maennich <maennich@...gle.com>
>> > Cc: Jessica Yu <jeyu@...nel.org>
>> > Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>
>> > Cc: Catalin Marinas <catalin.marinas@....com>
>> > Fixes: 8651ec01daed ("module: add support for symbol namespaces.")
>> > Reported-by: kbuild test robot <lkp@...el.com>
>> > Signed-off-by: Will Deacon <will@...nel.org>
>> > ---
>> >
>> > Please note that I've not been able to test this at LPC, but it's been
>> > submitted to kernelci.
>>
>> Thanks for fixing this so quickly. I can confirm that this fixes the
>> build for arm64 defconfig and x86 built fine for me as well. I'll wait
>> a bit and apply this at the end of the day in case Matthias or anybody
>> else would like to confirm/test.
>
>FWIW, I've managed to boot arm64 Debian under QEMU and load/unload
>modules successfully with this patch applied on top of modules-next.
Thanks Will for fixing this so quickly! The patch looks good to me.
Feel free to add
Reviewed-by: Matthias Maennich <maennich@...gle.com>
Tested-by: Matthias Maennich <maennich@...gle.com>
Cheers,
Matthias
Powered by blists - more mailing lists