From patchwork Thu Dec 3 06:48:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Lin X-Patchwork-Id: 11947997 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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 DCCC2C63777 for ; Thu, 3 Dec 2020 06:51:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4556320709 for ; Thu, 3 Dec 2020 06:51:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4556320709 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=andestech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9yaK+eBYmgFmVmmWLu+I1C2UoL30hffYBRaQhF+8VEM=; b=aox1YOxdEiM7CA/j8j/pyTVZqZ 3yjk+MmniEpQq5RLNY6cyZrF2NILqFs9WPg5PcG+7mawYSl0fxD+gFh+h1Z8ky7wAEqF20qKZnJx6 OMrRxOhv4qx2Z4ATCiAybv+qFH0Cs1WcrJD4JDfe7WA9P49P1Bq5a7s8GqeFMVxO8q/MJXQgc5YO0 igGEqp5qlGh06TIRfZ0FcZls6uqSh6QUBiAhtvDKnX25/0yg73yD7spYURPHF7Cm3cPN1kgJC9iOj 5au5GiHizFWLCp1I3sIrUpLyQ9F5+8VnsLQVbf8WOPO18ZiTSOVGSvYcf6C3NvGCIia+If3DggJeq VUElLVzw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkiS8-0001Rc-Dd; Thu, 03 Dec 2020 06:50:56 +0000 Received: from exmail.andestech.com ([60.248.187.195] helo=ATCSQR.andestech.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkiS3-0001PY-Rr for linux-riscv@lists.infradead.org; Thu, 03 Dec 2020 06:50:53 +0000 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id 0B36nZGV099083; Thu, 3 Dec 2020 14:49:35 +0800 (GMT-8) (envelope-from tesheng@andestech.com) Received: from atcfdc88.andestech.com (10.0.15.120) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.487.0; Thu, 3 Dec 2020 14:49:20 +0800 From: Eric Lin To: , , , , , , , , , , Subject: [PATCH v2 0/2] Let illegal access to user-space memory die Date: Thu, 3 Dec 2020 14:48:24 +0800 Message-ID: <20201203064826.30832-1-tesheng@andestech.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: [10.0.15.120] X-DNSRBL: X-MAIL: ATCSQR.andestech.com 0B36nZGV099083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_015052_404356_15231C63 X-CRM114-Status: UNSURE ( 6.17 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Lin Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Accesses to user-space memory without calling uaccess routine leads to hanging in page fault handler. Like arm64, we let it die earlier in page fault handler. Changes in v2: -Add a die_kernel_fault() helper -Split one long line code into two Eric Lin (2): riscv/mm: Introduce a die_kernel_fault() helper function riscv/mm: Prevent kernel module to access user memory without uaccess routines arch/riscv/mm/fault.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) Reviewed-by: Pekka Enberg