From: Will Deacon <will@kernel.org>
To: Jessica Yu <jeyu@kernel.org>
Cc: linux-kernel@vger.kernel.org, maco@android.com,
gregkh@linuxfoundation.org,
Matthias Maennich <maennich@google.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH] module: Fix link failure due to invalid relocation on namespace offset
Date: Wed, 11 Sep 2019 17:40:13 +0100 [thread overview]
Message-ID: <20190911164012.nalsccw6jku7gbpw@willie-the-truck> (raw)
In-Reply-To: <20190911133506.GB7837@linux-8ccs>
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@google.com>
> > Cc: Jessica Yu <jeyu@kernel.org>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Fixes: 8651ec01daed ("module: add support for symbol namespaces.")
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Will Deacon <will@kernel.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.
Will
next prev parent reply other threads:[~2019-09-11 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 12:26 [PATCH] module: Fix link failure due to invalid relocation on namespace offset Will Deacon
2019-09-11 13:35 ` Jessica Yu
2019-09-11 16:40 ` Will Deacon [this message]
2019-09-11 16:53 ` Matthias Maennich
2019-09-11 16:51 ` Ard Biesheuvel
2019-09-11 18:26 ` Jessica Yu
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=20190911164012.nalsccw6jku7gbpw@willie-the-truck \
--to=will@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=maennich@google.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;
as well as URLs for NNTP newsgroup(s).