public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: David Wilder <dwilder@us.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [patch 09/10] kprobes: fix instruction length calculation
Date: Wed, 22 Aug 2007 14:36:12 +0200	[thread overview]
Message-ID: <20070822123643.989489295@de.ibm.com> (raw)
In-Reply-To: 20070822123603.501231302@de.ibm.com

[-- Attachment #1: 009-kprobe-iln.diff --]
[-- Type: text/plain, Size: 1438 bytes --]

From: David Wilder <dwilder@us.ibm.com>

Placing a kprobe on "bc" instruction (s390/s390x) can cause an oops.
The instruction length is encoded into the first two bits of the s390
instruction. Kprobe is incorrectly computing the instruction length.
The instruction length is used for determining what type of "fix-up" is
needed for conditional branch instruction. The problem can bee seen by
placing a kprobe on a "bc" instruction that will not branch. The
results is that Kprobe incorrectly computes the new instruction
pointer (psw.addr) after single stepping the instruction. The problem
is corrected with this patch.

Signed-off-by: David Wilder <dwilder@us.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---

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

Index: quilt-2.6/arch/s390/kernel/kprobes.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/kprobes.c
+++ quilt-2.6/arch/s390/kernel/kprobes.c
@@ -85,7 +85,7 @@ void __kprobes get_instruction_type(stru
 	ainsn->reg = (*ainsn->insn & 0xf0) >> 4;
 
 	/* save the instruction length (pop 5-5) in bytes */
-	switch (*(__u8 *) (ainsn->insn) >> 4) {
+	switch (*(__u8 *) (ainsn->insn) >> 6) {
 	case 0:
 		ainsn->ilen = 2;
 		break;

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2007-08-22 12:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22 12:36 [patch 00/10] s390 patches for 2.6.23-rc3 Martin Schwidefsky
2007-08-22 12:36 ` [patch 01/10] cio: dont forget to set last slot to NULL in ccw_uevent() Martin Schwidefsky
2007-08-22 12:36 ` [patch 02/10] cio: change confusing message in cmf Martin Schwidefsky
2007-08-22 12:36 ` [patch 03/10] qdio: fix EQBS handling on CCQ96 Martin Schwidefsky
2007-08-22 12:36 ` [patch 04/10] qdio: Refresh buffer states for IQDIO Asynchronous output queue Martin Schwidefsky
2007-08-22 12:36 ` [patch 05/10] vmur: fix diag14 exceptions with addresses > 2GB Martin Schwidefsky
2007-08-22 12:36 ` [patch 06/10] vmur: fix reference counting for vmur device structure Martin Schwidefsky
2007-08-22 12:36 ` [patch 07/10] disassembler: fix b2 opcodes like srst, bsg, and others Martin Schwidefsky
2007-08-22 12:36 ` [patch 08/10] hypfs: inode corruption due to missing locking Martin Schwidefsky
2007-08-22 12:36 ` Martin Schwidefsky [this message]
2007-08-22 12:36 ` [patch 10/10] Change atomic_read/set to inline functions with barrier semantics Martin Schwidefsky

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=20070822123643.989489295@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=dwilder@us.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.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