public inbox for gentoo-sparc@lists.gentoo.org
 help / color / mirror / Atom feed
From: alexmcwhirter@triadic.us
To: gentoo-sparc@lists.gentoo.org
Cc: Jack Morgan <jmorgan@gentoo.org>
Subject: Re: [gentoo-sparc] Official SPARC64 Port
Date: Tue, 09 Aug 2016 01:14:09 -0400	[thread overview]
Message-ID: <724f1ba4a26c0f1e75e4b4be2a79c0e4@triadic.us> (raw)
In-Reply-To: <2d21669d-5598-f6b9-beda-2e1e9ef45e06@gentoo.org>

On 2016-08-08 18:52, Jack Morgan wrote:
> Any update on this issue? rsync is still broken on sparc.

Yes it, as well as ssh, ssl, and ext4 bugs were fixed via this patch. It 
was taged for stable.



-------- Original Message --------
Subject: [PATCH] sparc: Don't leak context bits into 
thread->fault_address
Date: 2016-07-27 20:53
 From: David Miller <davem@davemloft.net>
To: sparclinux@vger.kernel.org
Cc: mpatocka@redhat.com

On pre-Niagara systems, we fetch the fault address on data TLB
exceptions from the TLB_TAG_ACCESS register.  But this register also
contains the context ID assosciated with the fault in the low 13 bits
of the register value.

This propagates into current_thread_info()->fault_address and can
cause trouble later on.

So clear the low 13-bits out of the TLB_TAG_ACCESS value in the cases
where it matters.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
  arch/sparc/kernel/dtlb_prot.S |  4 ++--
  arch/sparc/kernel/ktlb.S      | 12 ++++++++++++
  arch/sparc/kernel/tsb.S       | 12 ++++++++++--
  3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/kernel/dtlb_prot.S 
b/arch/sparc/kernel/dtlb_prot.S
index d668ca14..4087a62 100644
--- a/arch/sparc/kernel/dtlb_prot.S
+++ b/arch/sparc/kernel/dtlb_prot.S
@@ -25,13 +25,13 @@

  /* PROT ** ICACHE line 2: More real fault processing */
  	ldxa		[%g4] ASI_DMMU, %g5		! Put tagaccess in %g5
+	srlx		%g5, PAGE_SHIFT, %g5
+	sllx		%g5, PAGE_SHIFT, %g5		! Clear context ID bits
  	bgu,pn		%xcc, winfix_trampoline		! Yes, perform winfixup
  	 mov		FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
  	ba,pt		%xcc, sparc64_realfault_common	! Nope, normal fault
  	 nop
  	nop
-	nop
-	nop

  /* PROT ** ICACHE line 3: Unused...	*/
  	nop
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index ef0d8e9..f22bec0 100644
--- a/arch/sparc/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
@@ -20,6 +20,10 @@ kvmap_itlb:
  	mov		TLB_TAG_ACCESS, %g4
  	ldxa		[%g4] ASI_IMMU, %g4

+	/* The kernel executes in context zero, therefore we do not
+	 * need to clear the context ID bits out of %g4 here.
+	 */
+
  	/* sun4v_itlb_miss branches here with the missing virtual
  	 * address already loaded into %g4
  	 */
@@ -128,6 +132,10 @@ kvmap_dtlb:
  	mov		TLB_TAG_ACCESS, %g4
  	ldxa		[%g4] ASI_DMMU, %g4

+	/* The kernel executes in context zero, therefore we do not
+	 * need to clear the context ID bits out of %g4 here.
+	 */
+
  	/* sun4v_dtlb_miss branches here with the missing virtual
  	 * address already loaded into %g4
  	 */
@@ -251,6 +259,10 @@ kvmap_dtlb_longpath:
  	nop
  	.previous

+	/* The kernel executes in context zero, therefore we do not
+	 * need to clear the context ID bits out of %g5 here.
+	 */
+
  	be,pt	%xcc, sparc64_realfault_common
  	 mov	FAULT_CODE_DTLB, %g4
  	ba,pt	%xcc, winfix_trampoline
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index be98685..d568c82 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -29,13 +29,17 @@
  	 */
  tsb_miss_dtlb:
  	mov		TLB_TAG_ACCESS, %g4
+	ldxa		[%g4] ASI_DMMU, %g4
+	srlx		%g4, PAGE_SHIFT, %g4
  	ba,pt		%xcc, tsb_miss_page_table_walk
-	 ldxa		[%g4] ASI_DMMU, %g4
+	 sllx		%g4, PAGE_SHIFT, %g4

  tsb_miss_itlb:
  	mov		TLB_TAG_ACCESS, %g4
+	ldxa		[%g4] ASI_IMMU, %g4
+	srlx		%g4, PAGE_SHIFT, %g4
  	ba,pt		%xcc, tsb_miss_page_table_walk
-	 ldxa		[%g4] ASI_IMMU, %g4
+	 sllx		%g4, PAGE_SHIFT, %g4

  	/* At this point we have:
  	 * %g1 --	PAGE_SIZE TSB entry address
@@ -284,6 +288,10 @@ tsb_do_dtlb_fault:
  	nop
  	.previous

+	/* Clear context ID bits.  */
+	srlx		%g5, PAGE_SHIFT, %g5
+	sllx		%g5, PAGE_SHIFT, %g5
+
  	be,pt	%xcc, sparc64_realfault_common
  	 mov	FAULT_CODE_DTLB, %g4
  	ba,pt	%xcc, winfix_trampoline


  reply	other threads:[~2016-08-09  5:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28 23:06 [gentoo-sparc] Official SPARC64 Port Alex McWhirter
2016-01-28 23:26 ` [gentoo-sparc] " Mike Frysinger
2016-01-28 23:37   ` Alex McWhirter
2016-01-28 23:46     ` Mike Frysinger
2016-01-30  0:28 ` [gentoo-sparc] " Alex McWhirter
2016-01-30  0:44   ` Mike Frysinger
2016-01-30  0:55     ` Alex McWhirter
2016-02-01  9:24       ` Alex McWhirter
2016-02-01 17:44       ` Mike Frysinger
2016-02-01 19:29         ` Alex McWhirter
2016-02-01 20:24           ` Mike Frysinger
2016-02-01 20:34             ` Alex McWhirter
2016-02-01 20:51               ` Mike Frysinger
2016-02-01 22:03                 ` Alex McWhirter
2016-02-04 18:40                   ` Alex McWhirter
2016-02-04 21:54                     ` Mike Frysinger
2016-02-04 23:44                       ` Alex McWhirter
2016-02-07 10:35                         ` Alex McWhirter
2016-02-08 15:21                           ` Mike Frysinger
2016-02-08 20:48                             ` Alex McWhirter
2016-02-09  5:11                               ` Alex McWhirter
2016-02-09  6:14                                 ` Mike Frysinger
2016-02-13  9:26                                   ` Alex McWhirter
2016-02-13 11:25                                     ` Mike Frysinger
2016-02-13 17:32                                       ` Alex McWhirter
2016-02-13 21:26                                         ` Alex McWhirter
2016-02-14  0:44                                           ` Mike Frysinger
2016-02-14 23:44                                             ` Alex McWhirter
2016-02-15  2:13                                               ` Mike Frysinger
2016-02-17 22:11                                                 ` Alex McWhirter
2016-02-17 22:46                                                   ` Mike Frysinger
2016-02-17 22:52                                                     ` Alex McWhirter
2016-02-19  8:37                                                       ` Alex McWhirter
2016-03-11  3:53                                                         ` Alex McWhirter
2016-08-08 22:52                                                           ` Jack Morgan
2016-08-09  5:14                                                             ` alexmcwhirter [this message]
2016-08-10 18:45                                                               ` Jack Morgan
2016-08-31 17:26                                                                 ` alexmcwhirter
2016-09-01  0:46                                                                   ` Jack Morgan
2016-09-04 19:27                                                                     ` [gentoo-sparc] -fPIC vs -fpic = Headaches alexmcwhirter

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=724f1ba4a26c0f1e75e4b4be2a79c0e4@triadic.us \
    --to=alexmcwhirter@triadic.us \
    --cc=gentoo-sparc@lists.gentoo.org \
    --cc=jmorgan@gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox