Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1789564pxp; Mon, 7 Mar 2022 02:22:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJypFGBF0HH3PHXNyVNrfYaG2ZL8AP3DHE8IFqqjaKaFwdIufZ2WlZxGGdwuS5xeanSZrf7S X-Received: by 2002:a17:902:ec83:b0:151:f2a8:d7 with SMTP id x3-20020a170902ec8300b00151f2a800d7mr1617259plg.166.1646648521170; Mon, 07 Mar 2022 02:22:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646648521; cv=none; d=google.com; s=arc-20160816; b=EGygEBM+7/zH3hge4bsk6wy1HQSNhtA+TbY+/82diQPsgxqkvlt9uhMFnh6DdMgDXp puwYu+t/2HqE+B2Iz8VVaARFyvJ/aelUYy68+uMW+ItnqqG9S/diXtQft4OAfWKpx29b NY4AgMTjpyeVQr+xPnFg2byyIC58rR0r0bnJmCVwT7jAXfVOqCH/uX/k9ONCqBM6sig7 +eedtu83YjzkTos5U1XsWdqBnOZVa8ZPnIeNLugO+2/WMhPh3wq9em/ubCGgOWCeTKzg qWBIHKuar1yQWAlM63WebGMXN/ZPDFOpdVr5ZLQKSAa/m/Divo64wfopBpHdoHzEW8Fn /bag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LPYWVXKo1FEzPiEuuuHB+w+kWbAL2WH2t8r40HNwgOE=; b=HNhLWcfk7fPNkuDBQzio/U/T+2FfGE9GygdCCcZ8WhavnqxmTMo/RH3II2P4/eDELf rcIenloVe6Sgn9HCVN5PUWX5PmR12iRWFZRnjk5AanwMQWwq3PsfqM+b4MKDTVIzcqyg tNdbO72ch0KEnWsZmsQGE6xfN+SoWILDRAlGf3RAzBPO1E8rI8sqa2esOYsQlIgzmOjM XYM62HNLjQn2tC0GNK+RThISEoKJsSFuIGZHIUvZL60a3a+SEAcAscUfy7IJ8+UD1IfC hcbdfoPoTgfXvr3r0IYw//cZYEt2V5ObafCoCr5hnowjl+GQZFP/8dFUJm8f8PHYQA1s zhXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SWi0G/Pt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a1709027c8300b0014fdaf37566si11175585pll.180.2022.03.07.02.21.47; Mon, 07 Mar 2022 02:22:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SWi0G/Pt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238734AbiCGJz5 (ORCPT + 99 others); Mon, 7 Mar 2022 04:55:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238536AbiCGJid (ORCPT ); Mon, 7 Mar 2022 04:38:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C307A443C6; Mon, 7 Mar 2022 01:32:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 860C061287; Mon, 7 Mar 2022 09:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F63C341C7; Mon, 7 Mar 2022 09:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646645570; bh=KjGoanFe9yX2UdN5dVRQKQaNmaQjJPnPPFDSw4zrYPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SWi0G/PtKc/3LpNqPAGwE5s8098JSZljOvZ9l97Ue8uZqsTgrRcJp/NBvtMCOvigv nMHr/+getDwpcK4BfGV2SpMxJ/R1KkSPhTiKuvKAy4Gvdn9HTCqY0MCoBNqydbFgkX Hyh+VIjexHKAc9PZ58Cyyysyl5r+M17Ui4UGcMzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Stezenbach , "Russell King (Oracle)" Subject: [PATCH 5.10 074/105] ARM: Fix kgdb breakpoint for Thumb2 Date: Mon, 7 Mar 2022 10:19:17 +0100 Message-Id: <20220307091646.259281048@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091644.179885033@linuxfoundation.org> References: <20220307091644.179885033@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King (Oracle) commit d920eaa4c4559f59be7b4c2d26fa0a2e1aaa3da9 upstream. The kgdb code needs to register an undef hook for the Thumb UDF instruction that will fault in order to be functional on Thumb2 platforms. Reported-by: Johannes Stezenbach Tested-by: Johannes Stezenbach Fixes: 5cbad0ebf45c ("kgdb: support for ARCH=arm") Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/kgdb.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c @@ -154,22 +154,38 @@ static int kgdb_compiled_brk_fn(struct p return 0; } -static struct undef_hook kgdb_brkpt_hook = { +static struct undef_hook kgdb_brkpt_arm_hook = { .instr_mask = 0xffffffff, .instr_val = KGDB_BREAKINST, - .cpsr_mask = MODE_MASK, + .cpsr_mask = PSR_T_BIT | MODE_MASK, .cpsr_val = SVC_MODE, .fn = kgdb_brk_fn }; -static struct undef_hook kgdb_compiled_brkpt_hook = { +static struct undef_hook kgdb_brkpt_thumb_hook = { + .instr_mask = 0xffff, + .instr_val = KGDB_BREAKINST & 0xffff, + .cpsr_mask = PSR_T_BIT | MODE_MASK, + .cpsr_val = PSR_T_BIT | SVC_MODE, + .fn = kgdb_brk_fn +}; + +static struct undef_hook kgdb_compiled_brkpt_arm_hook = { .instr_mask = 0xffffffff, .instr_val = KGDB_COMPILED_BREAK, - .cpsr_mask = MODE_MASK, + .cpsr_mask = PSR_T_BIT | MODE_MASK, .cpsr_val = SVC_MODE, .fn = kgdb_compiled_brk_fn }; +static struct undef_hook kgdb_compiled_brkpt_thumb_hook = { + .instr_mask = 0xffff, + .instr_val = KGDB_COMPILED_BREAK & 0xffff, + .cpsr_mask = PSR_T_BIT | MODE_MASK, + .cpsr_val = PSR_T_BIT | SVC_MODE, + .fn = kgdb_compiled_brk_fn +}; + static int __kgdb_notify(struct die_args *args, unsigned long cmd) { struct pt_regs *regs = args->regs; @@ -210,8 +226,10 @@ int kgdb_arch_init(void) if (ret != 0) return ret; - register_undef_hook(&kgdb_brkpt_hook); - register_undef_hook(&kgdb_compiled_brkpt_hook); + register_undef_hook(&kgdb_brkpt_arm_hook); + register_undef_hook(&kgdb_brkpt_thumb_hook); + register_undef_hook(&kgdb_compiled_brkpt_arm_hook); + register_undef_hook(&kgdb_compiled_brkpt_thumb_hook); return 0; } @@ -224,8 +242,10 @@ int kgdb_arch_init(void) */ void kgdb_arch_exit(void) { - unregister_undef_hook(&kgdb_brkpt_hook); - unregister_undef_hook(&kgdb_compiled_brkpt_hook); + unregister_undef_hook(&kgdb_brkpt_arm_hook); + unregister_undef_hook(&kgdb_brkpt_thumb_hook); + unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook); + unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook); unregister_die_notifier(&kgdb_notifier); }