Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp652693ybx; Thu, 7 Nov 2019 00:21:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyQF5Jlp1hdloCUQrVUJiefsFvRiDHDvsNVnZ/9T4hjtB/+98YlUS7LLaO0bULnUPw8HOai X-Received: by 2002:a17:906:1d41:: with SMTP id o1mr1193786ejh.333.1573114879186; Thu, 07 Nov 2019 00:21:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573114879; cv=none; d=google.com; s=arc-20160816; b=PuCgQAZfMy+85I3JXdhM0joeE87vFGNj6UyhnbqIdcxIjzPiGJTDNJWcoQ3Oxnr2yi KHZgwN589HxholIRxaCnVw4IJuD8c04pMOu5afSmyH0k9uGtSlk6XWVvBZwgSvEf6FGX lVRIyQnt7k6BPSf3jV3f5YFtxyLiPpkjMgHlvE4v/Hr3VrRiUfcgLwr3ytj4q6g5TjS/ WH/xb/wZz48p9yQBAUKb7ZGVWWpmH4alRrAz/Mj9WqxCK/UcTGC6JD9anou7Tton4eO9 GoOgRZA5ScXjBoIsM2lMKRATvUA1mUstqgp+yAqtXCo8rfc6+OQTglWR+4gSarsCxHlv SMDA== 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:to :from; bh=S4MPhMVl3s19T0mTxKe4IbFlFW/tOxpFeZM7I92n2Zs=; b=DPvvpnDmz6zFv3NmxmKv2kx4Ur+MVyZY/p8r7SeadblqWo74/A3597cfO5NtQmfNIp QaAUyQNJut7q/MRsNhyy8vSYM4XMhX8fxH4EuOkmE0VWmff2of5jczr/pz+au2VsEj8h rrNV+zkkYb6IXqTO6iYBt9FkqgH6HU2velEmACuCKJ8mkqlypRlTp2ojfMjhX4stYJ7r uR7O49yph6ooZjYDQePHqWN1CeHJWFrl9iyPuxR0JL/48tsiVS7oIR7gGPpMmD5umoLd xTHkCJ+bTqN4Ot2oZhGkuf4+AEkRtGEiqK+xFFg5mGcCKlzME9kZIUr2YNbrKHlx+h7f OO/g== 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 f31si884167edf.75.2019.11.07.00.20.55; Thu, 07 Nov 2019 00:21:19 -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 S1727582AbfKGIT1 (ORCPT + 99 others); Thu, 7 Nov 2019 03:19:27 -0500 Received: from mx1.unisoc.com ([222.66.158.135]:16164 "EHLO SHSQR01.unisoc.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726800AbfKGIT1 (ORCPT ); Thu, 7 Nov 2019 03:19:27 -0500 X-Greylist: delayed 1909 seconds by postgrey-1.27 at vger.kernel.org; Thu, 07 Nov 2019 03:19:26 EST Received: from SHSQR01.spreadtrum.com (localhost [127.0.0.2] (may be forged)) by SHSQR01.unisoc.com with ESMTP id xA77lUVu065852 for ; Thu, 7 Nov 2019 15:47:30 +0800 (CST) (envelope-from lvqiang.huang@unisoc.com) Received: from ig2.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTPS id xA77j9w1060787 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Thu, 7 Nov 2019 15:45:09 +0800 (CST) (envelope-from lvqiang.huang@unisoc.com) Received: from localhost (10.0.74.59) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 7 Nov 2019 15:45:14 +0800 From: Lvqiang To: , , , , , , , , , , Subject: [PATCH] ARM: check __ex_table in do_bad() Date: Thu, 7 Nov 2019 15:45:13 +0800 Message-ID: <1573112713-10115-1-git-send-email-Lvqiang.Huang@unisoc.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.74.59] X-ClientProxiedBy: shcas04.spreadtrum.com (10.29.35.89) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com xA77j9w1060787 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We got many crashs in for_each_frame+0x18 arch/arm/lib/backtrace.S 1003: ldr r2, [sv_pc, #-4] The backtrace is dump_backtrace show_stack sched_show_task show_state_filter sysrq_handle_showstate_blocked __handle_sysrq write_sysrq_trigger proc_reg_write __vfs_write vfs_write sys_write Related Kernel config CONFIG_CPU_SW_DOMAIN_PAN=y # CONFIG_ARM_UNWIND is not set CONFIG_FRAME_POINTER=y The task A was dumping the stack of an UN task B. However, the task B scheduled to run on another CPU, which cause it stack content changed. Then, task A may hit a page domain fault and die(). [520.661314] Unhandled fault: page domain fault (0x01b) at 0x32848c02 The addr 0x32848c02 is a valid user-space address. PAGE DIRECTORY: d1854000 PGD: d1854ca0 => bb21e835 PMD: d1854ca0 => bb21e835 PTE: bb21e120 => afffa79f With CONFIG_CPU_SW_DOMAIN_PAN=y, a page domain fault occurred. { do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault"}, Without check the __ex_table entry, do_bad() just return fault and die(). .pushsection __ex_table,"a" .long 1003b, 1006b This patch try __ex_table in do_bad(), the same as in __do_kernel_fault(). Signed-off-by: Lvqiang --- arch/arm/mm/fault.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index bd0f482..22f45df 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -487,11 +487,14 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) #endif /* CONFIG_ARM_LPAE */ /* - * This abort handler always returns "fault". + * Checks __ex_table before returns "fault". */ static int do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { + if (fixup_exception(regs)) + return 0; + return 1; } -- 1.7.9.5