Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3424964yba; Tue, 7 May 2019 00:37:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMAOqM+wZQ8Di/IaO969vhZIs9Bawkmw+Z/RrAIpbMtuDTDrNfKfGDnvPO5jBjET2p9HQI X-Received: by 2002:a62:fb0f:: with SMTP id x15mr39941959pfm.30.1557214673922; Tue, 07 May 2019 00:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557214673; cv=none; d=google.com; s=arc-20160816; b=sdJGfW71jvvuVpN/1/l+IZrB7zueAkiMeKeNYeTIFE4JPJ0Vi+G9hkxmTWjqU5O+b6 UgmVLs5gMAZfFMr8eBkw+2pT0dPU86pUAuQJ2+wjbKIo48pzNt7xiiVhJjWY32JRg/B7 B9lyX7ulvdddT3q/YgtGyq18ExrRgNze3m7IzVDH9Z3Vy+xy+fF/Newj9mJ1eKZNL1/p rj1Zk2xOSPCTZzc1je5xRZYKeshhMT88C/KrhstaDfKtexyMEHz5P6nb3eDKZVY17MCC 7lQAyZbErdpyEg+SFYVLKfSaXbufCFP/3SVR3YD3PvxBkg3h1Dq83IFrFwRLcNCWU3R9 UhyQ== 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:message-id:date :cc:subject:to:from; bh=Epl//lBa+zVv/CZgukf48gpV6X+8IEmm+jUoIlnfDKo=; b=txneD5nBHmZEu78hcSe6d/23+ILzyh1OOWdLRPolDKWSm7GMtIXr7Xs3jrGp7yyYu4 KMOBiGmOZn01J/88A+3r5eF7Ub6LYcEwBqg0PxtJZnEw+zN6/40UCAmcT0tc7c4VnGAF +iv7LHYdyp3CRh/rpUNO1N+TQYVRgCRGiCSkaJwmLXOc1aIT6Ye+0WM5KL6xTL1vYmzh gA5UerMW/dlGMRv0LyXhzZMYoIevwx6KMFKT48mI8eBGpvHHQeMc+KHRSkxyLTtjJdWS ugUKb2y0+sy4hCzmvvoXdR6XF3PhiXMxlrXNm7XgcNyiqslFdn8S7jZSo1m98DvJ/zNK xDnQ== 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 a67si19702614pfb.50.2019.05.07.00.37.37; Tue, 07 May 2019 00:37:53 -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 S1726780AbfEGHgr (ORCPT + 99 others); Tue, 7 May 2019 03:36:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:56868 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726449AbfEGHgr (ORCPT ); Tue, 7 May 2019 03:36:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 83F24AD17; Tue, 7 May 2019 07:36:46 +0000 (UTC) From: Andreas Schwab To: linux-riscv@lists.infradead.org Subject: [PATCH] riscv: fix locking violation in page fault handler CC: linux-kernel@vger.kernel.org X-Yow: I'm rated PG-34!! Date: Tue, 07 May 2019 09:36:46 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a user mode process accesses an address in the vmalloc area do_page_fault tries to unlock the mmap semaphore when it isn't locked. Signed-off-by: Andreas Schwab --- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 88401d5125bc..c51878e5a66a 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -181,6 +181,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) up_read(&mm->mmap_sem); /* User mode accesses just cause a SIGSEGV */ if (user_mode(regs)) { +bad_area_do_trap: do_trap(regs, SIGSEGV, code, addr, tsk); return; } @@ -230,7 +231,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) int index; if (user_mode(regs)) - goto bad_area; + goto bad_area_do_trap; /* * Synchronize this task's top level page-table -- 2.21.0 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."