* [PATCH] arm64: move elf notes into readonly segment
@ 2013-08-23 15:16 Mark Salter
2013-08-27 10:49 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Mark Salter @ 2013-08-23 15:16 UTC (permalink / raw)
To: catalin.marinas, will.deacon; +Cc: linux-kernel
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 = .;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: move elf notes into readonly segment
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
0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2013-08-27 10:49 UTC (permalink / raw)
To: Mark Salter; +Cc: Will Deacon, linux-kernel
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.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: move elf notes into readonly segment
2013-08-27 10:49 ` Catalin Marinas
@ 2013-08-27 13:01 ` Mark Salter
2013-08-27 14:27 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Mark Salter @ 2013-08-27 13:01 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Will Deacon, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: move elf notes into readonly segment
2013-08-27 13:01 ` Mark Salter
@ 2013-08-27 14:27 ` Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2013-08-27 14:27 UTC (permalink / raw)
To: Mark Salter; +Cc: Will Deacon, linux-kernel
On Tue, Aug 27, 2013 at 02:01:01PM +0100, Mark Salter wrote:
> 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.
OK, I got it now. I'll queue the patch for 3.12.
Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-27 14:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-08-27 14:27 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox