Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp895971yba; Thu, 18 Apr 2019 11:22:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwRnvw4eMgfUEvKZfSwZv4g5W2ky61wk9M/FuQ4L+X6Ms6c/2dSyAaQrSUe7G8MPSpU9C1 X-Received: by 2002:a17:902:8d83:: with SMTP id v3mr95597876plo.283.1555611767379; Thu, 18 Apr 2019 11:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611767; cv=none; d=google.com; s=arc-20160816; b=IiBzuwrBEGQtm2XJDXKpwS6S43WC1oO+UFFjdH/N/icmvJzKKqjPlunN1PPVSO97n2 6NrqcOYciU3T6hGHRaUxYtWodVz5oCr5OMwf+fj5qp/tKtyT3NRUwqgkVCpyKIutxGX/ FGGnBxrn7ssbWmEV5NAvavYvc5r+vmkCPE90FSfEc2lkep5Q1tJIUa4UcBWrsW5YXFdY Tw6mELex2gMl0cpRJ0jYaPlZV9Q253paMh5GWBBCcaP0md8r7TwmLOQdzpTMn4OcA2Ug rFQCXRed7sxTV2SrIW3epktceLdlQjwYuW7b/1WSAnDLUSzYwjbGNEfDYDaHwPgFGmau owyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jhiqaKf7HpNphVXqlT0QX7y+HFeV9eVesvO+yG1yexQ=; b=br4WXCbAEt2BFKItvXBttWrTkMQ48+J7clEyfJ9Y/80L8PIn29ipeE0HKLyVBCdJ5c 9vZ4Qu2LnSlGvwO9kcWeAtFRJhYBcY6hmK/qyA4qp15Yl2Ruu8qiX0rUJWxafn1TpY6k x8XiouZahBSlPzajJUzMne5PJCk30TEz49uvIjLtdE2H8OCZse/fch/h2nj03vIbXovX u+0CVzMlwdQTdh/2fusHjIHAC976M2r9GL2mBcqWO+zb482DjmCbMRinLzUyk3eqV6NR AkHLya44sz1ZCFrwEDRvwmVN9yXVWS+mAj7RkDdd76dmAU/SEz+OrvWXp/jaXlOnob78 QpDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qdkA2QmO; 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 y62si2491186pgd.142.2019.04.18.11.22.32; Thu, 18 Apr 2019 11:22:47 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=qdkA2QmO; 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 S2391796AbfDRSIv (ORCPT + 99 others); Thu, 18 Apr 2019 14:08:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:40192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391789AbfDRSIt (ORCPT ); Thu, 18 Apr 2019 14:08:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03AAD21872; Thu, 18 Apr 2019 18:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610928; bh=8RwdhNu0g0nIe+g7ofHWU6Cdf6aGp0tp+B0Qd2kzXSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qdkA2QmOHoq7y5MSDwc9yrGXBkYNCwqthQ1imUpNkplAYSmGMRjdSUYYi5LHeDyf7 RxPE0yUsxvsXixjsnMba59qU3mqOXmkmOSMZJbDwNfreXN3mZgtra5/cC2b3ZCd2Ly HAnarLQFztY7AefcFe2a5tpLj6FMcFO5tmWhIp3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Shi , Sebastian Andrzej Siewior , Arnd Bergmann , Russell King , Sasha Levin Subject: [PATCH 4.9 44/50] ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t Date: Thu, 18 Apr 2019 19:57:55 +0200 Message-Id: <20190418160427.778810744@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 143c2a89e0e5fda6c6fd08d7bc1126438c19ae90 ] When running kprobe on -rt kernel, the below bug is caught: |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:931 |in_atomic(): 1, irqs_disabled(): 128, pid: 14, name: migration/0 |Preemption disabled at:[<802f2b98>] cpu_stopper_thread+0xc0/0x140 |CPU: 0 PID: 14 Comm: migration/0 Tainted: G O 4.8.3-rt2 #1 |Hardware name: Freescale LS1021A |[<8025a43c>] (___might_sleep) |[<80b5b324>] (rt_spin_lock) |[<80b5c31c>] (__patch_text_real) |[<80b5c3ac>] (patch_text_stop_machine) |[<802f2920>] (multi_cpu_stop) Since patch_text_stop_machine() is called in stop_machine() which disables IRQ, sleepable lock should be not used in this atomic context, so replace patch_lock to raw lock. Signed-off-by: Yang Shi Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Arnd Bergmann Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/kernel/patch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c index 69bda1a5707e..1f665acaa6a9 100644 --- a/arch/arm/kernel/patch.c +++ b/arch/arm/kernel/patch.c @@ -15,7 +15,7 @@ struct patch { unsigned int insn; }; -static DEFINE_SPINLOCK(patch_lock); +static DEFINE_RAW_SPINLOCK(patch_lock); static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) __acquires(&patch_lock) @@ -32,7 +32,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) return addr; if (flags) - spin_lock_irqsave(&patch_lock, *flags); + raw_spin_lock_irqsave(&patch_lock, *flags); else __acquire(&patch_lock); @@ -47,7 +47,7 @@ static void __kprobes patch_unmap(int fixmap, unsigned long *flags) clear_fixmap(fixmap); if (flags) - spin_unlock_irqrestore(&patch_lock, *flags); + raw_spin_unlock_irqrestore(&patch_lock, *flags); else __release(&patch_lock); } -- 2.19.1