All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Salter <msalter@redhat.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <Will.Deacon@arm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: move elf notes into readonly segment
Date: Tue, 27 Aug 2013 09:01:01 -0400	[thread overview]
Message-ID: <1377608461.2127.15.camel@deneb.redhat.com> (raw)
In-Reply-To: <20130827104949.GE19897@arm.com>

On Tue, 2013-08-27 at 11:49 +0100, Catalin Marinas wrote:
> On Fri, Aug 23, 2013 at 04:16:42PM +0100, Mark Salter wrote:
> > The current vmlinux.lds.S places the notes sections between the
> > end of rw data and start of bss. This means that _edata doesn't
> > really point to the end of data. Since notes are read-only, this
> > patch moves them to the read-only segment so that _edata does
> > point to the end of initialized rw data.
> > 
> > Signed-off-by: Mark Salter <msalter@redhat.com>
> > ---
> >  arch/arm64/kernel/vmlinux.lds.S | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> > index f5e5574..f8ab9d8 100644
> > --- a/arch/arm64/kernel/vmlinux.lds.S
> > +++ b/arch/arm64/kernel/vmlinux.lds.S
> > @@ -71,6 +71,7 @@ SECTIONS
> >  
> >  	RO_DATA(PAGE_SIZE)
> >  	EXCEPTION_TABLE(8)
> > +	NOTES
> >  	_etext = .;			/* End of text and rodata section */
> >  
> >  	. = ALIGN(PAGE_SIZE);
> > @@ -122,8 +123,6 @@ SECTIONS
> >  	}
> >  	_edata_loc = __data_loc + SIZEOF(.data);
> >  
> > -	NOTES
> > -
> >  	BSS_SECTION(0, 0, 0)
> >  	_end = .;
> 
> The _edata is set before NOTES, so I don't fully understand where the
> problem is.
> 
The problem *is* _edata before the NOTES. We need a symbol to mark the
end of initialized data. This should be _edata but _edata doesn't
currently account for NOTES. In the EFI stub I'm working on, the PE/COFF
header needs to know the end of the image. If we use _edata, we wouldn't
include NOTES, so we're left with __bss_start. But _bss_start may not be
exactly right because of alignment rounding and it is ugly to use for
that purpose. So we either need a new symbol following NOTES, or move
_edata past NOTES, or move NOTES. I chose the latter because NOTES are
readonly and don't really need to be part of the RW segment.

--Mark



  reply	other threads:[~2013-08-27 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 15:16 [PATCH] arm64: move elf notes into readonly segment Mark Salter
2013-08-27 10:49 ` Catalin Marinas
2013-08-27 13:01   ` Mark Salter [this message]
2013-08-27 14:27     ` Catalin Marinas

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=1377608461.2127.15.camel@deneb.redhat.com \
    --to=msalter@redhat.com \
    --cc=Will.Deacon@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.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.