Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827517imm; Mon, 3 Sep 2018 10:27:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaVS1FrmMdX0gorwth58uQo3V9v2c0puN7Uh9WeSh1pWTj6NXG/UoHmZe6xbLLdVcTZk6at X-Received: by 2002:a62:7e93:: with SMTP id z141-v6mr4721898pfc.14.1535995669367; Mon, 03 Sep 2018 10:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995669; cv=none; d=google.com; s=arc-20160816; b=CF6CV83vvqVuIX73P+YGpa+dSsT6Su7oDgJm3RG32FINmgnQau0tqfZd0Y/29DbmkU 2UmpOkc2jU/n41C1nGD5rtGCx66n9Q8UBse0jX9Z7Lb+t2l8hKHt7MPcnYn4wSdAmsGe 2grOMOLuX9CiGJyh5VzxY8PPGQRBLJ7gTF9KVw4pQSVbFZNetRhZpftQvfJfiKXupRA8 xbCW2sTi7n+9ChpZ9BVW8XLgN4VcHHbuEepzz65W/c00na8WrIcc4wx8Iz9GS0+bfLm7 1wohS78MkBSi4ECL3BcIpCpUik+acZKp49vK3D1gcVJySpBRFIhlY5czrGu64CHembRf Ua0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=59vuRam1NPdLau8yaLh/iff5k4MeL12eYfw3XdO7U38=; b=0rfWxaJtvamGchaljbYtbTCv92gxhEdCGgnnnErE5gDW1+lS29hTD82Bw4YHe0Kxam zpqb1vrUczjER/uh4nFXv2HQ6p6pb+JX0bVNBH/N2y0TdWhg3cSgAXIN1gOWYPQhGGxR 3AUVQvqxTF9zp2sSOJvPENX5TrHbo3z0JhXjf7LauP4ZqrCZPDjDEfF7iPcxyJ/7rVCb 5Mw0YHNlbGMCj6QhBGwSVIfVGcO9GdkRdU/lz+8cC/soGmDfuWuo9x/Og7OYYq59p5Yu miBxIHZLOTJKbCgOl1caZberdOYhhbE4lVUW8cIVZAMy+mELXQ3RZgfRG3P7iSGxLWSK 6NEA== ARC-Authentication-Results: i=1; mx.google.com; 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 o9-v6si18515076pgf.331.2018.09.03.10.27.34; Mon, 03 Sep 2018 10:27:49 -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; 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 S1730606AbeICVri (ORCPT + 99 others); Mon, 3 Sep 2018 17:47:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45900 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728541AbeICVri (ORCPT ); Mon, 3 Sep 2018 17:47:38 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DFE8ED24; Mon, 3 Sep 2018 17:26:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudio Imbrenda , Martin Schwidefsky Subject: [PATCH 4.14 102/165] s390/kvm: fix deadlock when killed by oom Date: Mon, 3 Sep 2018 18:56:28 +0200 Message-Id: <20180903165700.634036258@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudio Imbrenda commit 306d6c49ac9ded11114cb53b0925da52f2c2ada1 upstream. When the oom killer kills a userspace process in the page fault handler while in guest context, the fault handler fails to release the mm_sem if the FAULT_FLAG_RETRY_NOWAIT option is set. This leads to a deadlock when tearing down the mm when the process terminates. This bug can only happen when pfault is enabled, so only KVM clients are affected. The problem arises in the rare cases in which handle_mm_fault does not release the mm_sem. This patch fixes the issue by manually releasing the mm_sem when needed. Fixes: 24eb3a824c4f3 ("KVM: s390: Add FAULT_FLAG_RETRY_NOWAIT for guest fault") Cc: # 3.15+ Signed-off-by: Claudio Imbrenda Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -486,6 +486,8 @@ retry: /* No reason to continue if interrupted by SIGKILL. */ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) { fault = VM_FAULT_SIGNAL; + if (flags & FAULT_FLAG_RETRY_NOWAIT) + goto out_up; goto out; } if (unlikely(fault & VM_FAULT_ERROR))