From patchwork Wed Aug 27 05:08:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 36073 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 304DF2054F for ; Wed, 27 Aug 2014 05:20:31 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id at20sf52213250iec.7 for ; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=Yw7HW4zZNTQFd0QMfYKNFwk9JYRNBeXAfFGytoFVNlw=; b=CdYDKZVtyBv9YgLa0lbg4VvZJLn3pOaNusW7/QOnqzAJtMQPOGP1QB+ob251eMNBsO cqZsdYBQZzZ+in0ffDzHI5SCtc6hkGzkqlzeP1FPrnLdnQyaT96xiG28rNxzFT+5UM+x 7Rt6oxX+Exre+vJ5GdqhvLwwfTXTgxgq538o6Mlsrjc3P097IQaWW+ZTswIwFAnWQwIm N1/EMkvIJULvj6t83FE9BLJLhUYgTof/avfPMns4lfeoscZ/IBAOyE8hRTYaaxfzghNA ii92c9lWmwfKT+9SeaKpjja/n2CITDMU6Z4xaGDvL66SFjJ0u/m24sS4Bv0GUB7uP3Z9 10Zw== X-Gm-Message-State: ALoCoQmPJDfBBnAzq1F1bKIIQUnCg3mrzSlhAe30ok2YBqPs4EVcOFlVtbT3n4qbo5Ph6cUaQ5JT X-Received: by 10.182.66.234 with SMTP id i10mr21042101obt.12.1409116830617; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.133 with SMTP id c5ls3043292qga.38.gmail; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) X-Received: by 10.236.230.8 with SMTP id i8mr3041655yhq.40.1409116830473; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) Received: from mail-yh0-f50.google.com (mail-yh0-f50.google.com [209.85.213.50]) by mx.google.com with ESMTPS id i8si4330972yhq.50.2014.08.26.22.20.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 22:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.50 as permitted sender) client-ip=209.85.213.50; Received: by mail-yh0-f50.google.com with SMTP id v1so12935003yhn.37 for ; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) X-Received: by 10.52.253.39 with SMTP id zx7mr10967140vdc.2.1409116830354; Tue, 26 Aug 2014 22:20:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp31037vcb; Tue, 26 Aug 2014 22:20:29 -0700 (PDT) X-Received: by 10.66.235.1 with SMTP id ui1mr43188380pac.28.1409116829494; Tue, 26 Aug 2014 22:20:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bz3si7375278pab.107.2014.08.26.22.20.28 for ; Tue, 26 Aug 2014 22:20:29 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932627AbaH0FU0 (ORCPT + 26 others); Wed, 27 Aug 2014 01:20:26 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:32097 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbaH0FUZ (ORCPT ); Wed, 27 Aug 2014 01:20:25 -0400 Received: from 172.24.2.119 (EHLO lggeml407-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CAW02638; Wed, 27 Aug 2014 13:20:15 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml407-hub.china.huawei.com (10.72.61.85) with Microsoft SMTP Server id 14.3.158.1; Wed, 27 Aug 2014 13:20:02 +0800 From: Wang Nan To: "David A. Long" , Russell King , Jon Medhurst , Taras Kondratiuk , Ben Dooks CC: Wang Nan , , , Subject: [PATCH] ARM: probes: return directly when emulate not set Date: Wed, 27 Aug 2014 13:08:29 +0800 Message-ID: <1409116109-67330-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When kprobe decoding instruction, original code calls instruction specific decoder if emulate is set to false. However, instructions with DECODE_TYPE_EMULATE are in fact don't have their decoder. What in the action table are in fact handlers. For example: /* LDRD (immediate) cccc 000x x1x0 xxxx xxxx xxxx 1101 xxxx */ /* STRD (immediate) cccc 000x x1x0 xxxx xxxx xxxx 1111 xxxx */ DECODE_EMULATEX (0x0e5000d0, 0x004000d0, PROBES_LDRSTRD, REGS(NOPCWB, NOPCX, 0, 0, 0)), and const union decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = { ... [PROBES_LDRSTRD] = {.handler = emulate_ldrdstrd}, ... In this situation, original code calls 'emulate_ldrdstrd' as a decoder, which is obviously incorrect. This patch makes it returns INSN_GOOD directly when 'emulate' is not true. Signed-off-by: Wang Nan Cc: "David A. Long" Cc: Russell King Cc: Jon Medhurst Cc: Taras Kondratiuk Cc: Ben Dooks --- arch/arm/kernel/probes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/kernel/probes.c b/arch/arm/kernel/probes.c index a8ab540..1c77b8d 100644 --- a/arch/arm/kernel/probes.c +++ b/arch/arm/kernel/probes.c @@ -436,8 +436,7 @@ probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, struct decode_emulate *d = (struct decode_emulate *)h; if (!emulate) - return actions[d->handler.action].decoder(insn, - asi, h); + return INSN_GOOD; asi->insn_handler = actions[d->handler.action].handler; set_emulated_insn(insn, asi, thumb);