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_PASS,URIBL_BLOCKED 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 AB406C10F03 for ; Tue, 23 Apr 2019 20:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75AA1217D9 for ; Tue, 23 Apr 2019 20:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556052627; bh=o85snI+xfD+RUOh5d6azWNDvOWhtKnfanQ3XKTztpnA=; h=Subject:To:Cc:From:Date:List-ID:From; b=mYs4QMdmjzoAT5eF8sxIHOk7VRGydgcEQXeyaqmURu7B3WPyk5vOa+AzgSVTHXg5z LI/KLsK6NwpsggyUWUMLyjgp1/JTRxvpLoVxobkRhcSoPluYELPH+6mUrBmmyqSEr8 ysHsSadwezIBtLIiniyPRiqxl7YJVvwQAIi2MbHU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfDWUu0 (ORCPT ); Tue, 23 Apr 2019 16:50:26 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58883 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfDWUu0 (ORCPT ); Tue, 23 Apr 2019 16:50:26 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D60E021448; Tue, 23 Apr 2019 16:50:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 23 Apr 2019 16:50:25 -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=fm2; bh=YXP//D enV2hVtozBsTQtOH5JO9jCLEVjMTIbqAWKmgw=; b=NVAh6EDQwY7qEA6bRQPkA9 FldQnzfqaxaKmVcASBC152jX2PEnjz2JwRmaAq/aX2nDGXg7YsohH0DnUTP53HKj gJNL2CLAnuRz5GZjZ+3vsOkHLHnxuKge02zMu0Q6JH1tUWByWepV9B0NhQB5YIDK 9Us7EOQADUK/gfJAOBmiNfdhw9CB7VJyQ1kqqBG2gDhX+q48msK/RNzs8kgsoPks CG06J2FJnidedR8OwrCeQaSFAws/vFWDLOtm/uWrK3MHBlJc36lHL3AbEHGGf/XX AeuAOy5ASiJ9hqOqGSdKH5wYVeLqGVmsy2IHNKd9zffGlsX4iRjTp+Zqb9pxAuKQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrgeekgddugeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepiedvrdduleefrdehtd drvddvleenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm necuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) by mail.messagingengine.com (Postfix) with ESMTPA id C1ED6E4472; Tue, 23 Apr 2019 16:50:24 -0400 (EDT) Subject: FAILED: patch "[PATCH] x86/speculation: Prevent deadlock on ssb_state::lock" failed to apply to 4.9-stable tree To: tglx@linutronix.de, mikhail.v.gavrilov@gmail.com, thomas.lendacky@amd.com Cc: From: Date: Tue, 23 Apr 2019 22:50:23 +0200 Message-ID: <15560526231736@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 2f5fb19341883bb6e37da351bc3700489d8506a7 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 14 Apr 2019 19:51:06 +0200 Subject: [PATCH] x86/speculation: Prevent deadlock on ssb_state::lock Mikhail reported a lockdep splat related to the AMD specific ssb_state lock: CPU0 CPU1 lock(&st->lock); local_irq_disable(); lock(&(&sighand->siglock)->rlock); lock(&st->lock); lock(&(&sighand->siglock)->rlock); *** DEADLOCK *** The connection between sighand->siglock and st->lock comes through seccomp, which takes st->lock while holding sighand->siglock. Make sure interrupts are disabled when __speculation_ctrl_update() is invoked via prctl() -> speculation_ctrl_update(). Add a lockdep assert to catch future offenders. Fixes: 1f50ddb4f418 ("x86/speculation: Handle HT correctly on AMD") Reported-by: Mikhail Gavrilov Signed-off-by: Thomas Gleixner Tested-by: Mikhail Gavrilov Cc: Thomas Lendacky Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1904141948200.4917@nanos.tec.linutronix.de diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 58ac7be52c7a..957eae13b370 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -426,6 +426,8 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, u64 msr = x86_spec_ctrl_base; bool updmsr = false; + lockdep_assert_irqs_disabled(); + /* * If TIF_SSBD is different, select the proper mitigation * method. Note that if SSBD mitigation is disabled or permanentely @@ -477,10 +479,12 @@ static unsigned long speculation_ctrl_update_tif(struct task_struct *tsk) void speculation_ctrl_update(unsigned long tif) { + unsigned long flags; + /* Forced update. Make sure all relevant TIF flags are different */ - preempt_disable(); + local_irq_save(flags); __speculation_ctrl_update(~tif, tif); - preempt_enable(); + local_irq_restore(flags); } /* Called from seccomp/prctl update */