Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754698AbcKBKOr (ORCPT ); Wed, 2 Nov 2016 06:14:47 -0400 Received: from mail-qk0-f171.google.com ([209.85.220.171]:34247 "EHLO mail-qk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593AbcKBKOp (ORCPT ); Wed, 2 Nov 2016 06:14:45 -0400 Subject: Re: [PATCH V3 2/6] arm64: kgdb_step_brk_fn: ignore other's exception To: Sandeepa Prabhu References: <9d2c9444762f1623e75b7de9e5783a94a257a00d.1478068479.git.panand@redhat.com> Cc: linux-arm-kernel , Catalin Marinas , Will Deacon , open list , William Cohen , oleg@redhat.com, dave.long@redhat.com, Steve Capper , srikar@linux.vnet.ibm.com, vijaya.kumar@caviumnetworks.com From: Pratyush Anand Message-ID: <2afdd880-86a0-4029-6c2f-091c5939fa95@redhat.com> Date: Wed, 2 Nov 2016 15:44:36 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1693 Lines: 49 On Wednesday 02 November 2016 03:30 PM, Sandeepa Prabhu wrote: > > > On Wed, Nov 2, 2016 at 2:40 PM, Pratyush Anand > wrote: > > ARM64 step exception does not have any syndrome information. So, it is > responsibility of exception handler to take care that they handle it > only if exception was raised for them. > > Since kgdb_step_brk_fn() always returns 0, therefore we might have > problem > when we will have other step handler registered as well. > > This patch fixes kgdb_step_brk_fn() to return error in case of step > handler > was not meant for kgdb. > > Signed-off-by: Pratyush Anand > > --- > arch/arm64/kernel/kgdb.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c > index e017a9493b92..d217c9e95b06 100644 > --- a/arch/arm64/kernel/kgdb.c > +++ b/arch/arm64/kernel/kgdb.c > @@ -247,6 +247,9 @@ NOKPROBE_SYMBOL(kgdb_compiled_brk_fn); > > static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr) > { > + if (!kgdb_single_step) > + return DBG_HOOK_ERROR; > + > > ​This is needed. So, single stepping in kprobes working all these days > because kprobes handler was registered earlier to kgdb handler!​ Actually kprobe_single_step_handler() is not called through call_step_hook(), so it is always safe. We had discussed here (https://lkml.org/lkml/2016/9/7/6) that why we can not register kprobe_single_step_handler() via register_set_hook() and only invoke call_step_hook(). ~Pratyush