All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <chunglin.tang@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Ley Foon Tan <lftan@altera.com>,
	Tobias Klauser <tklauser@distanz.ch>,
	cltang@codesourcery.com
Subject: [PATCH] nios2: __kuser_sigtramp placement fix
Date: Thu, 22 Jan 2015 15:14:31 +0800	[thread overview]
Message-ID: <54C0A357.4070701@gmail.com> (raw)

The address of __kuser_sigtramp is wrong by one word, due to padding
__kuser_cmpxchg to fully 64 bytes. The version word at the start of the
page displaces __kuser_sigtramp to 0x1044, instead of the intended 0x1040.

Fixed by counting the 64-byte frame from the start of the page instead
of __kuser_cmpxchg. This shortens the __kuser_cmpxchg frame to 60-bytes,
but that's likely enough.

The zero-byte padding parts of the kuser_pad macro has been removed, due
to the .if command refusing to behave properly when there are other
.word directives in between. Probably a binutils gas bug.

Thanks,
Chung-Lin

Cc: Ley Foon Tan <lftan@altera.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Chung-Lin Tang <cltang@codesourcery.com>

diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 0bdfd13..3224839 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -492,14 +492,7 @@ ENTRY(ret_from_kernel_thread)

  /* Filling pads with undefined instructions. */
 .macro	kuser_pad sym size
-	.if	((. - \sym) & 3)
-	.rept	(4 - (. - \sym) & 3)
-	.byte	0
-	.endr
-	.endif
-	.rept	((\size - (. - \sym)) / 4)
-	.word	0xdeadbeef
-	.endr
+	.fill	((\size - (. - \sym)) / 4), 4, 0xdeadbeef
 .endm

 	.align	6
@@ -526,7 +519,10 @@ cmpxchg_stw:
 cmpxchg_ret:
 	ret

-	kuser_pad __kuser_cmpxchg, 64
+	/* The first 64-byte frame contains the version word, so note
+	   that the first padding entry is based from the start of the kuser
+	   page, instead of __kuser_cmpxchg.  */
+	kuser_pad __kuser_helper_start, 64

 	.globl	__kuser_sigtramp
 __kuser_sigtramp:

             reply	other threads:[~2015-01-22  7:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  7:14 Chung-Lin Tang [this message]
2015-01-22  7:54 ` [PATCH] nios2: __kuser_sigtramp placement fix Ley Foon Tan
2015-01-22  8:15   ` Chung-Lin Tang
2015-01-22  8:43     ` Ley Foon Tan
2015-01-22  9:07       ` Chung-Lin Tang
2015-01-22  9:12         ` Ley Foon Tan

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=54C0A357.4070701@gmail.com \
    --to=chunglin.tang@gmail.com \
    --cc=cltang@codesourcery.com \
    --cc=lftan@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    /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.