From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763214AbXHVMgT (ORCPT ); Wed, 22 Aug 2007 08:36:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761186AbXHVMdP (ORCPT ); Wed, 22 Aug 2007 08:33:15 -0400 Received: from mtagate7.de.ibm.com ([195.212.29.156]:24387 "EHLO mtagate7.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760683AbXHVMc7 (ORCPT ); Wed, 22 Aug 2007 08:32:59 -0400 Message-Id: <20070822123643.989489295@de.ibm.com> References: <20070822123603.501231302@de.ibm.com> User-Agent: quilt/0.46-1 Date: Wed, 22 Aug 2007 14:36:12 +0200 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: David Wilder , Martin Schwidefsky , Heiko Carstens Subject: [patch 09/10] kprobes: fix instruction length calculation Content-Disposition: inline; filename=009-kprobe-iln.diff Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org From: David Wilder 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 Signed-off-by: Martin Schwidefsky Signed-off-by: Heiko Carstens --- 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.