lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1545159239-30628-3-git-send-email-vgupta@synopsys.com>
Date:   Tue, 18 Dec 2018 10:53:59 -0800
From:   Vineet Gupta <vineet.gupta1@...opsys.com>
To:     <linux-snps-arc@...ts.infradead.org>
CC:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <linux-arch@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        "Vineet Gupta" <vineet.gupta1@...opsys.com>
Subject: [PATCH 2/2] ARC: show_regs: fix lockdep splat for good

signal handling core calls ARCH show_regs() with preemption disabled
which causes __might_sleep functions such as mmput leading to lockdep
splat.  Workaround by re-enabling preemption temporarily.

This may not be as bad as it sounds since the preemption disabling
itself was introduced for a supressing smp_processor_id() warning in x86
code by commit 3a9f84d354ce ("signals, debug: fix BUG: using
smp_processor_id() in preemptible code in print_fatal_signal()")

Signed-off-by: Vineet Gupta <vgupta@...opsys.com>
---
 arch/arc/kernel/troubleshoot.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 2885bec71fb8..c650d3de13e1 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -177,6 +177,12 @@ void show_regs(struct pt_regs *regs)
 	struct task_struct *tsk = current;
 	struct callee_regs *cregs;
 
+	/*
+	 * generic code calls us with preemption disabled, but some calls
+	 * here could sleep, so re-enable to avoid lockdep splat
+	 */
+	preempt_enable();
+
 	print_task_path_n_nm(tsk);
 	show_regs_print_info(KERN_INFO);
 
@@ -219,6 +225,8 @@ void show_regs(struct pt_regs *regs)
 	cregs = (struct callee_regs *)current->thread.callee_reg;
 	if (cregs)
 		show_callee_regs(cregs);
+
+	preempt_disable();
 }
 
 void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ