linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] arm64/efi: efistub: jump to 'stext' directly, not through the header
Date: Fri, 10 Oct 2014 14:03:02 +0100	[thread overview]
Message-ID: <20141010130302.GC5294@leverpostej> (raw)
In-Reply-To: <CAKv+Gu-Kk=hZ78T+_ePceTgb9m4KmvpLcYOwvxEWuUcT+ScK_Q@mail.gmail.com>

[...]

> >> > But if the EFI loader is allowed to load stext at the precise start of
> >> > RAM (or anywhere not in the idmap), in attempting the copy we'd try to
> >> > access unmapped addresses.
> >> >
> >> > So if that's a possibility, we need to shrink the copy to cover stext
> >> > to _edata rather than _text to edata.
> >> >
> >> > Does that make sense?
> >> >
> >>
> >> That cannot happen. The PE/COFF .text section's positive relative
> >> virtual offset ensures that the memory image has room for the header,
> >> it's just not guaranteed that anything gets copied there.
> >
> > Ok. If we're guaranteed to have some space there, we're fine.
> >
> > I'm probably being a bit thick here, but where is the "positive relative
> > virtual offset" in the header? Which field defines that?
> >
> 
> The fields VirtualSize, VirtualAddress (the field I was referring to),
> SizeOfRawData and PointerToRawData define the relation between the
> file layout and the memory layout of the .text section (line 219 and
> up in head.S)

I guess my confusion is over the semantics of the VirtualAddress field.
If it's treated as an offset, what is that offset relative to in memory?
And what defines that the space covered by that offset is accessible?

> In our current definition, the memory offset and the file offset are
> identical (which this patch redefines as 'stext_offset'). The virtual
> size covers the entire static memory footprint of Image (minus the
> header). whereas the SizeOfRawData contains the size of the payload in
> the file (again, minus the header). The balance is zero initialized by
> the loader.

I can see why this guarantees there is space for stext to _end, but I
don't understand how this guarantees there is a valid mapping for the
region that would otherwise be _head to stext.

Thanks,
Mark.

  reply	other threads:[~2014-10-10 13:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 14:11 [PATCH v3] arm64/efi: efistub: jump to 'stext' directly, not through the header Ard Biesheuvel
2014-10-09 17:23 ` Mark Rutland
2014-10-09 19:03   ` Ard Biesheuvel
2014-10-09 22:19     ` Mark Salter
2014-10-09 23:20       ` Roy Franz
2014-10-10  6:30         ` Ard Biesheuvel
2014-10-10 14:14           ` Mark Salter
2014-10-10 14:28             ` Ard Biesheuvel
2014-10-10 13:53         ` Peter Jones
2014-10-10 10:49     ` Mark Rutland
2014-10-10 11:52       ` Ard Biesheuvel
2014-10-10 12:19         ` Mark Rutland
2014-10-10 12:31           ` Ard Biesheuvel
2014-10-10 13:03             ` Mark Rutland [this message]
2014-10-10 13:27               ` Ard Biesheuvel
2014-10-10 14:02                 ` Mark Rutland
2014-10-10 15:38                 ` Roy Franz
2014-10-10 15:52                   ` 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=20141010130302.GC5294@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 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).