From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/3] arm64: relocatable kernel proof of concept
Date: Mon, 16 Mar 2015 17:33:25 +0000 [thread overview]
Message-ID: <20150316173324.GA21040@leverpostej> (raw)
In-Reply-To: <CAKv+Gu_-1XMcpobRt7tXCZaqWoszWLfJxgHBLaKuWchz87UnSA@mail.gmail.com>
> >> - performance: we can align PHYS_OFFSET so that most of the linear mapping can
> >> be done using 512 MB or 1 GB blocks (depending on page size), instead of
> >> the more granular level that is currently unavoidable if Image cannot be
> >> loaded at base of RAM (since PHYS_OFFSET is tied to the start of the kernel
> >> Image).
> >
> > Isn't this gain somewhat offset by having to build the kernel as a PIE?
>
> I don't think so. Note that this is not -fpic code, it's just the ld
> option that dumps the reloc and dynsym tables into the output image.
> The reloc penalty is boottime only.
Ah, ok.
> > I have a very strong suspicion that bootloaders in the wild don't zero
> > x1-x3, and that given that we might not have a reliable mechanism for
> > acquiring the offset.
> >
>
> OK, sounds about time to start complaining about that then.
I guess so.
> >> Issues:
> >> - Since AArch64 uses the ELF RELA format (where the addends are in the
> >> relocation table and not in the code), the relocations need to be applied even
> >> if the Image runs from the same offset it was linked at. It also means that
> >> some values that are produced by the linker (_kernel_size_le, etc) are missing
> >> from the binary. This will probably need a fixup step.
> >> - The module area may be out of range, which needs to be worked around with
> >> module PLTs. This is straight forward but I haven't implemented it yet for
> >> arm64.
> >> - The core extable is most likely broken, and would need to be changed to use
> >> relative offsets instead of absolute addresses.
> >
> > This sounds like it's going to be a big headache.
> >
>
> It's all manageable, really. The module PLT thing is something I
> already implemented for 32-bit ARM here:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/305539.html
> (only Russell couldn't be bothered to merge it)
>
> The extable is already relative on x86, and the fixup step is some
> straight forward ELF mangling on vmlinux before performing the
> objcopy.
> But yes, it's rather ugly.
Hmm. I'd be rather worried about the fixup step; I suspect that'll be
fragile and rarely tested. Perhaps we could verify them at boot time?
> > I'd rather see that we decouple the kernel (text/data) mapping from the
> > linear mapping, with the former given a fixed VA independent of the PA
> > of the kernel Image (which would still need to be at a 2M-aligned
> > address + text_offset, and not straddling a 512M boundary).
> >
>
> Hmm, that's quite nice, actually, It also fixes the module range
> problem, and for VA randomization we could move both regions together.
Ah, good point. I hadn't consdiered modules all that much, but it sounds
like it could work.
Mark.
next prev parent reply other threads:[~2015-03-16 17:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 15:23 [RFC PATCH 0/3] arm64: relocatable kernel proof of concept Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 1/3] arm64: head.S: replace early literals with constant immediates Ard Biesheuvel
2015-03-16 17:14 ` Mark Rutland
2015-03-17 7:01 ` Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 2/3] arm64: add support for relocatable kernel Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 3/3] arm64/efi: use relocated kernel Ard Biesheuvel
2015-03-16 16:09 ` [RFC PATCH 0/3] arm64: relocatable kernel proof of concept Mark Rutland
2015-03-16 16:45 ` Ard Biesheuvel
2015-03-16 17:33 ` Mark Rutland [this message]
2015-03-16 17:43 ` Ard Biesheuvel
2015-03-17 16:20 ` Mark Rutland
2015-03-16 23:19 ` Kees Cook
2015-03-17 7:38 ` Ard Biesheuvel
2015-03-17 16:35 ` Mark Rutland
2015-03-17 16:40 ` Ard Biesheuvel
2015-03-17 16:43 ` Mark Rutland
2015-03-23 15:36 ` [PATCH 0/4] RFC: split text and linear mappings using tagged pointers Ard Biesheuvel
2015-03-23 15:36 ` [PATCH 1/4] arm64: use tagged pointers to distinguish kernel text from the linear mapping Ard Biesheuvel
2015-03-25 14:04 ` Catalin Marinas
2015-03-26 1:27 ` Mark Rutland
2015-03-23 15:36 ` [PATCH 2/4] arm64: fixmap: move translation tables to dedicated region Ard Biesheuvel
2015-03-26 1:28 ` Mark Rutland
2015-03-26 6:20 ` Ard Biesheuvel
2015-03-30 14:34 ` Mark Rutland
2015-03-23 15:36 ` [PATCH 3/4] arm64: move kernel text below PAGE_OFFSET Ard Biesheuvel
2015-03-25 14:10 ` Catalin Marinas
2015-03-23 15:36 ` [PATCH 4/4] arm64: align PHYS_OFFSET to block size Ard Biesheuvel
2015-03-25 14:14 ` Catalin Marinas
2015-03-26 6:23 ` Ard Biesheuvel
2015-03-25 14:59 ` Catalin Marinas
2015-03-26 6:22 ` Ard Biesheuvel
2015-03-27 13:16 ` Ard Biesheuvel
2015-03-30 13:49 ` Catalin Marinas
2015-03-30 14:00 ` Ard Biesheuvel
2015-03-30 14:55 ` Mark Rutland
2015-03-30 15:00 ` Catalin Marinas
2015-03-30 18:08 ` Ard Biesheuvel
2015-03-31 14:49 ` Catalin Marinas
2015-03-31 16:19 ` Catalin Marinas
2015-03-31 16:46 ` Catalin Marinas
2015-03-26 1:26 ` [PATCH 0/4] RFC: split text and linear mappings using tagged pointers Mark Rutland
2015-03-26 6:09 ` Ard Biesheuvel
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=20150316173324.GA21040@leverpostej \
--to=mark.rutland@arm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.