linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: Michael Ellerman <michael@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>,
	Nick Piggin <npiggin@au1.ibm.com>
Subject: [PATCH] powerpc: Fix check for copy/paste instructions in alignment handler
Date: Wed, 25 Oct 2017 18:16:53 +1100	[thread overview]
Message-ID: <20171025071653.GB25140@fergus.ozlabs.ibm.com> (raw)

Commit 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch
when possible", 2017-06-09) changed the definition of PPC_INST_COPY
and in so doing inadvertently broke the check for copy/paste
instructions in the alignment fault handler.  The check currently
matches no instructions.

This fixes it by ANDing both sides of the comparison with the mask.

Fixes: 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch
when possible")
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
Should go to 4.13 stable as well, and will probably apply there
with fuzz.

 arch/powerpc/kernel/align.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 43ef251..3e6c074 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -332,7 +332,7 @@ int fix_alignment(struct pt_regs *regs)
 	 * when pasting to a co-processor. Furthermore, paste_last is the
 	 * synchronisation point for preceding copy/paste sequences.
 	 */
-	if ((instr & 0xfc0006fe) == PPC_INST_COPY)
+	if ((instr & 0xfc0006fe) == (PPC_INST_COPY & 0xfc0006fe))
 		return -EIO;
 
 	r = analyse_instr(&op, regs, instr);
-- 
2.7.4

             reply	other threads:[~2017-10-25  7:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25  7:16 Paul Mackerras [this message]
2017-11-01  5:17 ` powerpc: Fix check for copy/paste instructions in alignment handler Michael Ellerman
     [not found] <OFF18C8ACF.135B0A8D-ON002581C4.002803F5@notes.na.collabserv.com>
2017-10-25 15:22 ` [PATCH] " Nicholas Piggin
2017-10-25 22:41   ` Paul Mackerras
     [not found]   ` <OFE75272CA.7B26179F-ON002581C4.007CAB23@notes.na.collabserv.com>
2017-10-26  5:19     ` Nicholas Piggin

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=20171025071653.GB25140@fergus.ozlabs.ibm.com \
    --to=paulus@ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=markus@trippelsdorf.de \
    --cc=michael@ellerman.id.au \
    --cc=npiggin@au1.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).