stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction
@ 2015-03-05  8:13 Jiri Slaby
  2015-03-05 23:22 ` Andy Lutomirski
  2015-03-06  8:39 ` [tip:x86/urgent] x86/vdso: Fix the build on GCC5 tip-bot for Jiri Slaby
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Slaby @ 2015-03-05  8:13 UTC (permalink / raw)
  To: luto
  Cc: linux-kernel, rguenther, Jiri Slaby, stable, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86

.LSTARTFDEDLSI1 says:
        /* HACK: The dwarf2 unwind routines will subtract 1 from the
           return address to get an address in the middle of the
           presumed call instruction.  Since we didn't get here via
           a call, we need to include the nop before the real start
           to make up for it.  */
        .long .LSTART_sigreturn-1-.     /* PC-relative start address */

But commit 69d0627a7f6e891189124d784d2fa90cae7c449a (x86 vDSO: reorder
vdso32 code) from 2.6.25 replaced
  .org __kernel_vsyscall+32,0x90
by ALIGN right before __kernel_sigreturn. Of course, ALIGN need not
generate any nop in there. Esp. gcc5 collapses vclock_gettime.o and
int80.o together with no generated nops as "ALIGN". In that case
kernel does not even link:
ld: .eh_frame_hdr table[4] FDE at 0000000000000648 overlaps table[5] FDE at 0000000000000670.

So fix this by adding there at least a single nop and make the
function ALIGN possibly with more nops then.

Kudos for reporting and diagnosing should go to Richard.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Richard Biener <rguenther@suse.de>
Cc: stable@vger.kernel.org
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/x86/vdso/vdso32/sigreturn.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
index 31776d0efc8c..d7ec4e251c0a 100644
--- a/arch/x86/vdso/vdso32/sigreturn.S
+++ b/arch/x86/vdso/vdso32/sigreturn.S
@@ -17,6 +17,7 @@
 	.text
 	.globl __kernel_sigreturn
 	.type __kernel_sigreturn,@function
+	nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
 	ALIGN
 __kernel_sigreturn:
 .LSTART_sigreturn:
-- 
2.3.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction
  2015-03-05  8:13 [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction Jiri Slaby
@ 2015-03-05 23:22 ` Andy Lutomirski
  2015-03-06  8:36   ` Ingo Molnar
  2015-03-06  8:39 ` [tip:x86/urgent] x86/vdso: Fix the build on GCC5 tip-bot for Jiri Slaby
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Lutomirski @ 2015-03-05 23:22 UTC (permalink / raw)
  To: Jiri Slaby, Jan Beulich
  Cc: linux-kernel@vger.kernel.org, rguenther, stable, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, X86 ML

On Thu, Mar 5, 2015 at 12:13 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> .LSTARTFDEDLSI1 says:
>         /* HACK: The dwarf2 unwind routines will subtract 1 from the
>            return address to get an address in the middle of the
>            presumed call instruction.  Since we didn't get here via
>            a call, we need to include the nop before the real start
>            to make up for it.  */
>         .long .LSTART_sigreturn-1-.     /* PC-relative start address */
>
> But commit 69d0627a7f6e891189124d784d2fa90cae7c449a (x86 vDSO: reorder
> vdso32 code) from 2.6.25 replaced
>   .org __kernel_vsyscall+32,0x90
> by ALIGN right before __kernel_sigreturn. Of course, ALIGN need not
> generate any nop in there. Esp. gcc5 collapses vclock_gettime.o and
> int80.o together with no generated nops as "ALIGN". In that case
> kernel does not even link:
> ld: .eh_frame_hdr table[4] FDE at 0000000000000648 overlaps table[5] FDE at 0000000000000670.
>
> So fix this by adding there at least a single nop and make the
> function ALIGN possibly with more nops then.
>
> Kudos for reporting and diagnosing should go to Richard.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Reported-by: Richard Biener <rguenther@suse.de>
> Cc: stable@vger.kernel.org
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> ---
>  arch/x86/vdso/vdso32/sigreturn.S | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
> index 31776d0efc8c..d7ec4e251c0a 100644
> --- a/arch/x86/vdso/vdso32/sigreturn.S
> +++ b/arch/x86/vdso/vdso32/sigreturn.S
> @@ -17,6 +17,7 @@
>         .text
>         .globl __kernel_sigreturn
>         .type __kernel_sigreturn,@function
> +       nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
>         ALIGN
>  __kernel_sigreturn:
>  .LSTART_sigreturn:

Acked-by: Andy Lutomirski <luto@amacapital.net>

Ingo or Thomas, can you apply this to tip:x86/urgent for this weekend?

Are we willing to depend on cfi-capable assemblers for 32-bit?  If so,
could we rewrite this garbage with .cfi directives?  The current code
is incomprehensible.

--Andy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction
  2015-03-05 23:22 ` Andy Lutomirski
@ 2015-03-06  8:36   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2015-03-06  8:36 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Jiri Slaby, Jan Beulich, linux-kernel@vger.kernel.org, rguenther,
	stable, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, X86 ML,
	Linus Torvalds, Andrew Morton, Borislav Petkov


* Andy Lutomirski <luto@amacapital.net> wrote:

> On Thu, Mar 5, 2015 at 12:13 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> > .LSTARTFDEDLSI1 says:
> >         /* HACK: The dwarf2 unwind routines will subtract 1 from the
> >            return address to get an address in the middle of the
> >            presumed call instruction.  Since we didn't get here via
> >            a call, we need to include the nop before the real start
> >            to make up for it.  */
> >         .long .LSTART_sigreturn-1-.     /* PC-relative start address */
> >
> > But commit 69d0627a7f6e891189124d784d2fa90cae7c449a (x86 vDSO: reorder
> > vdso32 code) from 2.6.25 replaced
> >   .org __kernel_vsyscall+32,0x90
> > by ALIGN right before __kernel_sigreturn. Of course, ALIGN need not
> > generate any nop in there. Esp. gcc5 collapses vclock_gettime.o and
> > int80.o together with no generated nops as "ALIGN". In that case
> > kernel does not even link:
> > ld: .eh_frame_hdr table[4] FDE at 0000000000000648 overlaps table[5] FDE at 0000000000000670.
> >
> > So fix this by adding there at least a single nop and make the
> > function ALIGN possibly with more nops then.
> >
> > Kudos for reporting and diagnosing should go to Richard.
> >
> > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> > Reported-by: Richard Biener <rguenther@suse.de>
> > Cc: stable@vger.kernel.org
> > Cc: Andy Lutomirski <luto@amacapital.net>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: x86@kernel.org
> > ---
> >  arch/x86/vdso/vdso32/sigreturn.S | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
> > index 31776d0efc8c..d7ec4e251c0a 100644
> > --- a/arch/x86/vdso/vdso32/sigreturn.S
> > +++ b/arch/x86/vdso/vdso32/sigreturn.S
> > @@ -17,6 +17,7 @@
> >         .text
> >         .globl __kernel_sigreturn
> >         .type __kernel_sigreturn,@function
> > +       nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
> >         ALIGN
> >  __kernel_sigreturn:
> >  .LSTART_sigreturn:
> 
> Acked-by: Andy Lutomirski <luto@amacapital.net>
> 
> Ingo or Thomas, can you apply this to tip:x86/urgent for this weekend?

Sure, I've applied it.

> Are we willing to depend on cfi-capable assemblers for 32-bit?  If 
> so, could we rewrite this garbage with .cfi directives?  The current 
> code is incomprehensible.

We could try, that code is certainly a mess. How much does that 
restrict our build compatibility?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:x86/urgent] x86/vdso: Fix the build on GCC5
  2015-03-05  8:13 [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction Jiri Slaby
  2015-03-05 23:22 ` Andy Lutomirski
@ 2015-03-06  8:39 ` tip-bot for Jiri Slaby
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jiri Slaby @ 2015-03-06  8:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: luto, linux-kernel, jslaby, stable, torvalds, bp, mingo,
	rguenther, hpa, tglx

Commit-ID:  e893286918d2cde3a94850d8f7101cd1039e0c62
Gitweb:     http://git.kernel.org/tip/e893286918d2cde3a94850d8f7101cd1039e0c62
Author:     Jiri Slaby <jslaby@suse.cz>
AuthorDate: Thu, 5 Mar 2015 09:13:31 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 6 Mar 2015 09:34:45 +0100

x86/vdso: Fix the build on GCC5

On gcc5 the kernel does not link:

  ld: .eh_frame_hdr table[4] FDE at 0000000000000648 overlaps table[5] FDE at 0000000000000670.

Because prior GCC versions always emitted NOPs on ALIGN directives, but
gcc5 started omitting them.

.LSTARTFDEDLSI1 says:

        /* HACK: The dwarf2 unwind routines will subtract 1 from the
           return address to get an address in the middle of the
           presumed call instruction.  Since we didn't get here via
           a call, we need to include the nop before the real start
           to make up for it.  */
        .long .LSTART_sigreturn-1-.     /* PC-relative start address */

But commit 69d0627a7f6e ("x86 vDSO: reorder vdso32 code") from 2.6.25
replaced .org __kernel_vsyscall+32,0x90 by ALIGN right before
__kernel_sigreturn.

Of course, ALIGN need not generate any NOP in there. Esp. gcc5 collapses
vclock_gettime.o and int80.o together with no generated NOPs as "ALIGN".

So fix this by adding to that point at least a single NOP and make the
function ALIGN possibly with more NOPs then.

Kudos for reporting and diagnosing should go to Richard.

Reported-by: Richard Biener <rguenther@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: <stable@vger.kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425543211-12542-1-git-send-email-jslaby@suse.cz
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/vdso/vdso32/sigreturn.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S
index 31776d0..d7ec4e2 100644
--- a/arch/x86/vdso/vdso32/sigreturn.S
+++ b/arch/x86/vdso/vdso32/sigreturn.S
@@ -17,6 +17,7 @@
 	.text
 	.globl __kernel_sigreturn
 	.type __kernel_sigreturn,@function
+	nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
 	ALIGN
 __kernel_sigreturn:
 .LSTART_sigreturn:

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-06  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05  8:13 [PATCH 1/1] x86/vdso: fix a reference to a non-existing instruction Jiri Slaby
2015-03-05 23:22 ` Andy Lutomirski
2015-03-06  8:36   ` Ingo Molnar
2015-03-06  8:39 ` [tip:x86/urgent] x86/vdso: Fix the build on GCC5 tip-bot for Jiri Slaby

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).