From patchwork Fri Oct 6 11:17:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 115046 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1667448qgn; Fri, 6 Oct 2017 04:18:51 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAqFHEfWLjIJ30n7hrQLsDKboU8lAuG3xz+w76r8+p5cdcVQihRcekwyn4rzzcTrjHrfN0Z X-Received: by 10.98.134.194 with SMTP id x185mr1927469pfd.8.1507288731556; Fri, 06 Oct 2017 04:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507288731; cv=none; d=google.com; s=arc-20160816; b=d+gqCPsqHC+BjiVHYT60PPVGe654+Law8DizR930vG2dD4vrrw4AX1MziXmK6AGUJM KGeq+IGRuqPU+VuEZ35OW+wVaUGtF19Y0kqj3O+dNkc29Ea0jMB4KM+vg0K6Mrbu1yO5 8kfsQyJC4Vq6KjrEHCS85ZYQ0jdaWIR0v4H4dr8ZjcUlISsTp0gFDCvgkZfJUHOJPYLy NdjfB9+BJIfHMLimbUQ9XB6GuW1dmZ32squSdIpOk1zxgtoNoGVntpKEgPrCW38l+RcB Dhqbbo8y8UFri54PmHFV+45ANKIjomc1m/vgIpA8TfslRdYJlHJB5su08g8QSAo1KuJ+ KU3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:dkim-signature :dkim-signature:cc:from:dkim-signature:arc-authentication-results; bh=NOGQE3I1wc99gOZhdCbEcROjMksIMvNUHoJhePjHr30=; b=xS2NN5ocH+XSt1XkqkSoMYxPpnAaYSOGqx61GXaBJ9001oDlqW8A3UwivaHO3/4M1b bLRJv7B1H8l2uQ4Zm0mxX/bUtNXVJCQBU6kOgVNexjH0kHHetU6IxTeA+N37PN2ACBsP HRwlc4hidL6iJWYP2ci2em/7SEDqoTUfjKLCDvk2BCjKywhq2JLAARAm9qLpzRsCCy0T Re+nFFCSGUziyLo/Li8ZzvPupKb7lusDc/S+umHZQGzu+3p4knlnpNkL9s+nrZyOBgi1 g1RCFqk8ebADTj3l7i2apegeqzh7njWKcu4T2XM0LBRmvQmBebuIdowG7yTNZiiwv482 FOYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verizon.com header.s=corp header.b=jn44XDNN; dkim=fail header.i=@verizon.com header.s=corp header.b=XaN3cOOT; dkim=fail header.i=@verizon.com header.s=corp header.b=Schx7BU2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si954507pgu.126.2017.10.06.04.18.51; Fri, 06 Oct 2017 04:18:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@verizon.com header.s=corp header.b=jn44XDNN; dkim=fail header.i=@verizon.com header.s=corp header.b=XaN3cOOT; dkim=fail header.i=@verizon.com header.s=corp header.b=Schx7BU2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752073AbdJFLSu (ORCPT + 8 others); Fri, 6 Oct 2017 07:18:50 -0400 Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:34173 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbdJFLSm (ORCPT ); Fri, 6 Oct 2017 07:18:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507288722; x=1538824722; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0JlFOzXIn9mCosLs4F2Hz/ZmVJj9LK+rweU91xhvnmg=; b=jn44XDNNllv6CnhM/yxfx/i+wsQcQor70as2q7xj7QEGkYWBdqNgtzX9 Sct4aomEQSAIsQAXV5V8DqQeBqrtd4uCI/byn01IPDUpEYvlHBIs5xrs8 MNKvAde95h2CwsB9x+EC8+1BKQSJebwOqwNWS6ZoJ68Lgv3yPFzTBgke+ g=; Received: from unknown (HELO fldsmtpi03.verizon.com) ([166.68.71.145]) by omzsmtpe03.verizonbusiness.com with ESMTP; 06 Oct 2017 11:18:40 +0000 From: "Levin, Alexander (Sasha Levin)" Cc: Mark Rutland , Will Deacon , "Levin, Alexander (Sasha Levin)" Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO apollo.verizonwireless.com) ([10.255.192.101]) by fldsmtpi03.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Oct 2017 11:18:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507288706; x=1538824706; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0JlFOzXIn9mCosLs4F2Hz/ZmVJj9LK+rweU91xhvnmg=; b=XaN3cOOTaeht/I4nJJ/dObhaDysdjTx862Vs54NLdijRv18oQ/rQ8Wqw gTiSJq+kfQjSprOiHbS304cotS7ou+BnlVGDpxev2ZHCzsxiinmlUXWJh rYo6dHHIOowNrbobIlzNoGjC6J1o4KTWPieGeBKlRw/thyf3dFXlm1zxS c=; Received: from pioneer.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.34]) by apollo.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Oct 2017 07:18:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1507288705; x=1538824705; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0JlFOzXIn9mCosLs4F2Hz/ZmVJj9LK+rweU91xhvnmg=; b=Schx7BU2/wZ8XtOc9kGBU4OOSlUo4OKVbeiy+Y5JB0FtgUo6CPUPURdl FtUuvWqOFloxHzwDLtEVwwmK+g4PA1nMu5NtNPJ4z42mh2+dhZQQvSDRf QU9SXCnP8TZ10iFrC3IqSD4RmmpTFk3Dyms0jjJJ+uE+vFVfT0zZHsZqs 4=; X-Host: pioneer.tdc.vzwcorp.com Received: from ohtwi1exh001.uswin.ad.vzwcorp.com ([10.144.218.43]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 06 Oct 2017 11:18:25 +0000 Received: from tbwexch01apd.uswin.ad.vzwcorp.com (153.114.162.25) by OHTWI1EXH001.uswin.ad.vzwcorp.com (10.144.218.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Oct 2017 07:18:25 -0400 Received: from OMZP1LUMXCA13.uswin.ad.vzwcorp.com (144.8.22.188) by tbwexch01apd.uswin.ad.vzwcorp.com (153.114.162.25) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 6 Oct 2017 07:18:25 -0400 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA13.uswin.ad.vzwcorp.com (144.8.22.188) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 6 Oct 2017 06:18:21 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Fri, 6 Oct 2017 06:18:21 -0500 To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" Subject: [added to the v4.1 stable tree] arm64: mm: abort uaccess retries upon fatal signal Thread-Topic: [added to the v4.1 stable tree] arm64: mm: abort uaccess retries upon fatal signal Thread-Index: AQHTPpS0N+a4kNAUeEGXhkjq0/EOdQ== Date: Fri, 6 Oct 2017 11:17:32 +0000 Message-ID: <20171006111704.25872-50-alexander.levin@verizon.com> References: <20171006111704.25872-1-alexander.levin@verizon.com> In-Reply-To: <20171006111704.25872-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Rutland This patch has been added to the v4.1 stable tree. If you have any objections, please let us know. -- 2.11.0 =============== [ Upstream commit 289d07a2dc6c6b6f3e4b8a62669320d99dbe6c3d ] When there's a fatal signal pending, arm64's do_page_fault() implementation returns 0. The intent is that we'll return to the faulting userspace instruction, delivering the signal on the way. However, if we take a fatal signal during fixing up a uaccess, this results in a return to the faulting kernel instruction, which will be instantly retried, resulting in the same fault being taken forever. As the task never reaches userspace, the signal is not delivered, and the task is left unkillable. While the task is stuck in this state, it can inhibit the forward progress of the system. To avoid this, we must ensure that when a fatal signal is pending, we apply any necessary fixup for a faulting kernel instruction. Thus we will return to an error path, and it is up to that code to make forward progress towards delivering the fatal signal. Cc: Catalin Marinas Cc: Laura Abbott Cc: stable@vger.kernel.org Reviewed-by: Steve Capper Tested-by: Steve Capper Reviewed-by: James Morse Tested-by: James Morse Signed-off-by: Mark Rutland Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/mm/fault.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 16523fbd9671..d0e42f6fcddd 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -253,8 +253,11 @@ retry: * signal first. We do not need to release the mmap_sem because it * would already be released in __lock_page_or_retry in mm/filemap.c. */ - if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) + if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) { + if (!user_mode(regs)) + goto no_context; return 0; + } /* * Major/minor page fault accounting is only done on the initial