From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4182AC433DF for ; Tue, 23 Jun 2020 11:57:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E5A920738 for ; Tue, 23 Jun 2020 11:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592913462; bh=Y51ECpwKqjwzDoLPRhkZw1qU4muG8W30OrUcuq/5Nxg=; h=Subject:To:Cc:From:Date:List-ID:From; b=zS4VoP8NPPVKPF30IDxkHgDaGd2eR7iHaE5SED+slV3Tjih0WtrjcShmPvLOdYOGq ISF2gWOd59j+Ju4M9X7eWsTbBvEzPC/C3ws1m00bMju35gTPOsrC7BRZpniZgjg5Rm MLw58+b0U82DzkHvYrILX1iEFIJPTcNtzmoMdD60= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732396AbgFWL5l (ORCPT ); Tue, 23 Jun 2020 07:57:41 -0400 Received: from wforward4-smtp.messagingengine.com ([64.147.123.34]:38389 "EHLO wforward4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732333AbgFWL5l (ORCPT ); Tue, 23 Jun 2020 07:57:41 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id E9F6FA08; Tue, 23 Jun 2020 07:57:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 23 Jun 2020 07:57:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=dDuH1H 0V9u3pMDq/z1Hm52809nnWdTdnI8bDYbMEDbU=; b=E9m1LwdVCto9vmco86+7t/ 2nYyThnclYkTh6WSodjDmzTo+axhYm6kOyNZQpIz9pQQtbpLZkBgeT2f6HDBM2Vl 0yvP3Sev5q2viSWZ051w03tqbKMAW1EnmahNoZwHVwXi+7MNzfHMLJ6vpYY5q7/b /Z0s22PYjQ7G+NEv/1b1k3jskxUWwm1fDrhN+mdNkDLu8l52KsfC/qzpaCVQ0tfd yXm0CozmPPElrmnIWxZE3ZLBp0iL1AlUKJG3h9Y5y67al2/DA1KSUEa8FadfsV52 DgzjTeTige1hvcA3hD0EGleMqzils865SyhMK7e4JeP49qaWYrFxP97XWiV6I3uA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekhedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepleelledvgeefleeltdetgedugeffgffhudffudduke egfeelgeeigeekjefhleevnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphep keefrdekiedrkeelrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 21077328005D; Tue, 23 Jun 2020 07:57:39 -0400 (EDT) Subject: FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree To: mhiramat@kernel.org, anders.roxell@linaro.org, anil.s.keshavamurthy@intel.com, davem@davemloft.net, gustavoars@kernel.org, mingo@elte.hu, mingo@kernel.org, naveen.n.rao@linux.ibm.com, peterz@infradead.org, rostedt@goodmis.org, zsun@redhat.com Cc: From: Date: Tue, 23 Jun 2020 13:57:26 +0200 Message-ID: <159291344624382@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.9-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Tue, 12 May 2020 17:02:56 +0900 Subject: [PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex In kprobe_optimizer() kick_kprobe_optimizer() is called without kprobe_mutex, but this can race with other caller which is protected by kprobe_mutex. To fix that, expand kprobe_mutex protected area to protect kick_kprobe_optimizer() call. Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2 Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing") Cc: Ingo Molnar Cc: "Gustavo A . R . Silva" Cc: Anders Roxell Cc: "Naveen N . Rao" Cc: Anil S Keshavamurthy Cc: David Miller Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Ziqian SUN Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index ceb0e273bd69..0e185763578b 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -592,11 +592,12 @@ static void kprobe_optimizer(struct work_struct *work) mutex_unlock(&module_mutex); mutex_unlock(&text_mutex); cpus_read_unlock(); - mutex_unlock(&kprobe_mutex); /* Step 5: Kick optimizer again if needed */ if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) kick_kprobe_optimizer(); + + mutex_unlock(&kprobe_mutex); } /* Wait for completing optimization and unoptimization */