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 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 87E23C10F03 for ; Tue, 23 Apr 2019 20:50:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55718217D9 for ; Tue, 23 Apr 2019 20:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556052636; bh=3i2VmAjcC/Lb0beS8eJx5KpCvHei4vKOaR8Fo7ZNYe4=; h=Subject:To:Cc:From:Date:List-ID:From; b=PDSjKY8TXJhMGrjEseEOhgJ2K5A9M1P0IysqxNqqG3mKRYJ/HhRF0dOqhGdl4OsEU vHTLxdKVzbdWGQdnv6NODDNmSsK/kGnLyL75WTSxm1UEUEgxafH8iMt9Olv6hHjiZC rVl2+1n6ex+J4TvLa0CjsdvlWZiM6lt9JHvwkMG8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbfDWUug (ORCPT ); Tue, 23 Apr 2019 16:50:36 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59953 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfDWUuf (ORCPT ); Tue, 23 Apr 2019 16:50:35 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B3ACC21FC2; Tue, 23 Apr 2019 16:50:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 23 Apr 2019 16:50:34 -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=gVO0g+ CcpSYgfUy4gEZ9cibeb8h/MH/F89rzuJhia4E=; b=UhLra9twXtEeRHHMCCt6R6 n87BqfA4XrFxYNRBcfgdVlE6YiUouipYFESI1/u/eWub8pTI6KE2B0iXix5Gcsp2 napu+gpMAQfhn+V0eYdj7MWbMHOBnUYu7NuumCNGKbacyBQhX8+QynvWqgZnFRVw foRC6Bw7I8JgTbFlS98EufxEPssVS6FFaPC9ZQdMYjOFVqvAF10RyXx7hN83B+kH FRbNpqWXHqgvW876IWrqAXFmjSONtXYdstuETYQYMs/FjFY990ppUQzcF4ucp145 /AL4Pbjtvv53YP6CNZ2Lx/agioOd8crs07Qqqe7CW+drhpOPl0MmAD95HHGa3bYg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrgeekgddugeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepiedvrdduleefrdehtd drvddvleenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm necuvehluhhsthgvrhfuihiivgepud X-ME-Proxy: Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) by mail.messagingengine.com (Postfix) with ESMTPA id 2B3DC103C8; Tue, 23 Apr 2019 16:50:34 -0400 (EDT) Subject: FAILED: patch "[PATCH] x86/speculation: Prevent deadlock on ssb_state::lock" failed to apply to 4.4-stable tree To: tglx@linutronix.de, mikhail.v.gavrilov@gmail.com, thomas.lendacky@amd.com Cc: From: Date: Tue, 23 Apr 2019 22:50:25 +0200 Message-ID: <1556052625149151@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.4-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 */