Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4641603imu; Tue, 29 Jan 2019 05:11:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN4XLjUeRdww9bJiz2zdHlwmqdFFknZTn+IK4+mcHNKLmV/KNkYfC2nj9FPFHCM4ymKLXT9w X-Received: by 2002:a63:9306:: with SMTP id b6mr22691189pge.36.1548767508519; Tue, 29 Jan 2019 05:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548767508; cv=none; d=google.com; s=arc-20160816; b=GK21+F2MftQ4ip74LHqhVC8NBNrKUqY8BeTyQTYbHlT1iYrrlbL8+I7TKjqGieRYc9 pRRhU6j1S3Aw/KWVLd+5rOWJIaHOCPJYi18uklBWX3eWqJT21O+Qt8iMQNG56i8K1jZz 6VzVn8XGPKfoySOJBhuPbU0oVCU4lyGDY/yZbngVdWSKd7qQKAM10PC7lMArTYGHwRdA LfVG2+rbpHPXlDDDF6Z0FpOW6N4pvp35sMmJl8DXUrL7H9p8zfFZfrP4jOAIqb+qRgMq SeibVrR+h8mV91FvDeey3HGxgcSM2O9+GXeoMxvLJmWV+XGf8ydR9SATsHhAYALaf/s3 pddA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=c051mRFSkQnQG566O/0XVusX/tmCfw0voS7k8Ln4Odc=; b=dZab0trruPGs4H/go7il+HQYoRz9dDGSedhZo6itRKOewiy/qG6SFGrCcB7lte4EdI WfLmQ24++WLMeGwR9lBlEyqPcBk/1jcz5GpH6ewpYO3yl/0bg3jb35zMkDu6dAhL6cti cebrpwE3C0UACJou+5IthcU3QoKHl20N8i74K0HoAnfuXNNO2kC/CtWOD5qHGVzkCcRd 7wMCHtERD6Jd932s4tYHq9KOKqXb/IFQ6NepNYtku6Djwp/LZyZfnV9nJL/bG0DsnRpw P1OC6ubPOZoX+Blmhvyimna+IoIRBik8xuRNOJ52g7qpPcPSpsRh7r7lZy2l84nPStZM KuVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay4si37117337plb.235.2019.01.29.05.11.32; Tue, 29 Jan 2019 05:11:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbfA2NK4 (ORCPT + 99 others); Tue, 29 Jan 2019 08:10:56 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3235 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725769AbfA2NK4 (ORCPT ); Tue, 29 Jan 2019 08:10:56 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 493922D077169EA4E213; Tue, 29 Jan 2019 21:10:54 +0800 (CST) Received: from euler.huawei.com (10.175.104.193) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.408.0; Tue, 29 Jan 2019 21:10:46 +0800 From: Wei Li To: , CC: , , , , , , , , , , Subject: [PATCH] arm64: fix potential deadlock in arm64-provide-pseudo-NMI-with-GICv3 Date: Tue, 29 Jan 2019 21:12:23 +0800 Message-ID: <20190129131223.32505-1-liwei391@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.193] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some exception handlers, the interrupt is not reenabled by daifclr at first. The later process may call local_irq_enable() to enable the interrupt, like gic_handle_irq(). As we known, function local_irq_enable() just change the pmr now. The following codes what i found may cause a deadlock or some issues else: do_sp_pc_abort <- el0_sp_pc do_el0_ia_bp_hardening <- el0_ia kgdb_roundup_cpus <- el1_dbg Signed-off-by: Wei Li --- arch/arm64/kernel/kgdb.c | 4 ++++ arch/arm64/mm/fault.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index a20de58061a8..119fbf2c0788 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -291,6 +292,9 @@ static void kgdb_call_nmi_hook(void *ignored) void kgdb_roundup_cpus(unsigned long flags) { + if (gic_prio_masking_enabled()) + gic_arch_enable_irqs(); + local_irq_enable(); smp_call_function(kgdb_call_nmi_hook, NULL, 0); local_irq_disable(); diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 97ba2ba78aee..f7c39a0b28bc 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -780,6 +781,8 @@ asmlinkage void __exception do_el0_ia_bp_hardening(unsigned long addr, if (addr > TASK_SIZE) arm64_apply_bp_hardening(); + if (gic_prio_masking_enabled()) + gic_arch_enable_irqs(); local_irq_enable(); do_mem_abort(addr, esr, regs); } @@ -794,6 +797,9 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr, if (user_mode(regs)) { if (instruction_pointer(regs) > TASK_SIZE) arm64_apply_bp_hardening(); + + if (gic_prio_masking_enabled()) + gic_arch_enable_irqs(); local_irq_enable(); } -- 2.17.1