From patchwork Thu Nov 1 15:27:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 991970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42m8GV4j4FzB4Xk; Fri, 2 Nov 2018 02:27:46 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gIEso-0000Mg-Je; Thu, 01 Nov 2018 15:27:42 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gIEsl-0000MY-UW for kernel-team@lists.ubuntu.com; Thu, 01 Nov 2018 15:27:39 +0000 Received: from mail-lf1-f70.google.com ([209.85.167.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gIEsl-0002ra-M3 for kernel-team@lists.ubuntu.com; Thu, 01 Nov 2018 15:27:39 +0000 Received: by mail-lf1-f70.google.com with SMTP id m18so1932019lfb.15 for ; Thu, 01 Nov 2018 08:27:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=jkarxpVWs0Btpc75nxZtKXGxnyUZzuPm+FVI8RzMuiM=; b=CY5x28orJ5vEbc8yZ6ygl/pP8hlDOmRGumPZTXDFO9LB5xVAMv82wNqQpa3qa7BaOV vs0o2LG9fQtbBwo/pgKL3mkHqDbajsy8aNve8uCy7qG25uKGHnlEoq0esAv0dD9IDyQ3 1NnPnXOH6aUihJEh4jIrz7iYuFZAv84B7HT2amLg8l5/wZvRxyB7QYDbL3ojqb27gMbs 6e2wb3lHDw5l2S1JN5y93qana47Uw5BFxsGE8ZZx6DVIc/9dJ0GLYcLcZGjNtD2v598N fYXuCj8kq3Zl1t7R05qJgzS/PDfy9g/4sZaoIrVLfuEcRCJMuwiB1SXUgi4Joh/AyQFu UAbA== X-Gm-Message-State: AGRZ1gLeQy9UBQBI0KGC296o5zcSAfzoD4vK9cWRC6NK1ESwG3r72IS2 tmnTJKAof9GPWXB9LC+rt4zyxmVsnH+BfloqbtBHviw75rK8TCiBnbMQ7tOdCPkD7G6C/+vr5ei V/O9KHi9N7Vhx0QuyjZmZLdIUfSW1TgaoeXCYve+2PR1QgiiKEFrkfKWAXw== X-Received: by 2002:a19:1cb:: with SMTP id 194mr4668235lfb.61.1541086058529; Thu, 01 Nov 2018 08:27:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5dbFJHVCnc+nru7MKwZYU0d96dV0d43LijClUVQAS61BCYQuYREnLIGYWe/9fceEOqey2cO9h5zBaRzMukzFVo= X-Received: by 2002:a19:1cb:: with SMTP id 194mr4668224lfb.61.1541086058158; Thu, 01 Nov 2018 08:27:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Thu, 1 Nov 2018 16:27:27 +0100 Message-ID: Subject: [SRU][Bionic][PATCH 1/1] s390/kvm: fix deadlock when killed by oom To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Claudio Imbrenda BugLink: http://bugs.launchpad.net/bugs/1800849 s390/kvm: fix deadlock when killed by oom 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 --- if (unlikely(fault & VM_FAULT_ERROR)) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index e074480..4cc3f06 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -502,6 +502,8 @@ static inline int do_exception(struct pt_regs *regs, int access) /* 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; }