lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090428083804.GB17622@uranus.ravnborg.org>
Date:	Tue, 28 Apr 2009 10:38:04 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org, mingo@...hat.com, hpa@...or.com,
	hpa@...icro.com, tglx@...utronix.de, hpa@...ux.intel.com,
	jeremy.fitzhardinge@...rix.com, linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/urgent] x86: linker script: avoid ALIGN statements inside output sections

On Tue, Apr 28, 2009 at 10:14:55AM +0200, Ingo Molnar wrote:
> 
> * tip-bot for H. Peter Anvin <hpa@...icro.com> wrote:
> 
> > Commit-ID:  c707f31e2e6af2d37bc742c31be0c7e96946c71f
> > Gitweb:     http://git.kernel.org/tip/c707f31e2e6af2d37bc742c31be0c7e96946c71f
> > Author:     H. Peter Anvin <hpa@...icro.com>
> > AuthorDate: Mon, 27 Apr 2009 13:09:45 -0700
> > Committer:  H. Peter Anvin <hpa@...icro.com>
> > CommitDate: Mon, 27 Apr 2009 13:09:45 -0700
> > 
> > x86: linker script: avoid ALIGN statements inside output sections
> > 
> > ALIGN statements inside output sections means that the alignment 
> > padding ends up part of the section.  This causes real problems 
> > when the section is otherwise empty.  ALIGN can be done either 
> > before the output section or as part of the output section header; 
> > the latter has the advantage that the alignment information is 
> > propagated into the appropriate ELF headers.
> > 
> > Without this patch, we produce invalid kernels in certain 
> > configurations involving X86_VSMP.
> > 
> > Reported-and-tested-by: Thomas Gleixner <tglx@...utronix.de>
> > Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> > Signed-off-by: H. Peter Anvin <hpa@...ux.intel.com>
> > 
> > 
> > ---
> >  arch/x86/kernel/vmlinux_32.lds.S |   45 +++++++++++++++-----------------
> >  arch/x86/kernel/vmlinux_64.lds.S |   52 +++++++++++++++++--------------------
> >  2 files changed, 45 insertions(+), 52 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
> > index 62ad500..7197db8 100644
> > --- a/arch/x86/kernel/vmlinux_32.lds.S
> > +++ b/arch/x86/kernel/vmlinux_32.lds.S
> > @@ -37,8 +37,7 @@ SECTIONS
> >    } :text = 0x9090
> >  
> >    /* read-only */
> > -  .text : AT(ADDR(.text) - LOAD_OFFSET) {
> > -	. = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
> > +  .text : AT(ADDR(.text) - LOAD_OFFSET) ALIGN(PAGE_SIZE) {
> >  	*(.text.page_aligned)
> >  	TEXT_TEXT
> >  	SCHED_TEXT
> > @@ -52,8 +51,8 @@ SECTIONS
> >  
> >    NOTES :text :note
> >  
> > -  . = ALIGN(16);		/* Exception table */
> > -  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
> > +  /* Exception table */
> > +  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) ALIGN(16) {
> 
> 
> this construct breaks older toolchains:
> 
> /opt/crosstool/gcc-4.2.3-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld:arch/x86/kernel/vmlinux.lds:138: 
> parse error
> 
> titan:~/tip> 
> /opt/crosstool/gcc-4.2.3-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld -v
> GNU ld version 2.16.1
> 
> this is what it does not like:
> 
>  __ex_table : AT(ADDR(__ex_table) - 0xffffffff80000000) ALIGN(16) {

Good to know. I was yesterday wondering why we did not use this.
As part of the .lds file cleanups I move ALIGN() out of the
output section as this is where it should be.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ